Additional Function Reference
RoME
RoME.getRangeKDEMax2D
— FunctiongetRangeKDEMax2D(fgl, vsym1, vsym2)
Calculate the cartesian distance between two vertices in the graph using their symbol name, and by maximum belief point.
RoME.initFactorGraph!
— FunctioninitFactorGraph!(
fg;
P0,
init,
N,
lbl,
solvable,
firstPoseType,
labels
)
Initialize a factor graph object as Pose2, Pose3, or neither and returns variable and factor symbols as array.
RoME.addOdoFG!
— FunctionaddOdoFG!(fg, n, DX, cov; N, solvable, labels)
Create a new variable node and insert odometry constraint factor between which will automatically increment latest pose symbol x<k+1> for new node new node and constraint factor are returned as a tuple.
addOdoFG!(fgl, odo; N, solvable, labels)
Create a new variable node and insert odometry constraint factor between which will automatically increment latest pose symbol x<k+1> for new node new node and constraint factor are returned as a tuple.
IncrementalInference
IncrementalInference.approxCliqMarginalUp!
— FunctionapproxCliqMarginalUp!(csmc; ...)
approxCliqMarginalUp!(
csmc,
childmsgs;
N,
dbg,
multiproc,
logger,
iters,
drawpdf
)
Approximate Chapman-Kolmogorov transit integral and return separator marginals as messages to pass up the Bayes (Junction) tree, along with additional clique operation values for debugging.
Notes
onduplicate=true
by default internally uses deepcopy of factor graph and Bayes tree, and does not update the given objects. Set false to updatefgl
andtreel
during compute.
Future
- TODO: internal function chain is too long and needs to be refactored for maintainability.
IncrementalInference.areCliqVariablesAllMarginalized
— FunctionareCliqVariablesAllMarginalized(subfg, cliq)
Return true if all variables in clique are considered marginalized (and initialized).
IncrementalInference.attemptTreeSimilarClique
— FunctionattemptTreeSimilarClique(othertree, seeksSimilar)
Special internal function to try return the clique data if succesfully identified in othertree::AbstractBayesTree
, based on contents of seeksSimilar::BayesTreeNodeData
.
Notes
- Used to identify and skip similar cliques (i.e. recycle computations)
IncrementalInference.childCliqs
— FunctionchildCliqs(treel, cliq)
Return a vector of child cliques to cliq
.
IncrementalInference.cliqHistFilterTransitions
— FunctioncliqHistFilterTransitions(hist, nextfnc)
Return state machine transition steps from history such that the nextfnc::Function
.
Related:
printCliqHistorySummary, filterHistAllToArray, sandboxCliqResolveStep
IncrementalInference.cycleInitByVarOrder!
— FunctioncycleInitByVarOrder!(subfg, varorder; solveKey, logger)
Cycle through var order and initialize variables as possible in subfg::AbstractDFG
. Return true if something was updated.
Notes:
- assumed
subfg
is a subgraph containing only the factors that can be used.- including the required up or down messages
- intended for both up and down initialization operations.
Dev Notes
- Should monitor updates based on the number of inferred & solvable dimensions
IncrementalInference.doautoinit!
— Functiondoautoinit!(dfg, xi; solveKey, singles, N, logger)
EXPERIMENTAL: initialize target variable xi
based on connected factors in the factor graph fgl
. Possibly called from addFactor!
, or doCliqAutoInitUp!
(?).
Notes:
- Special carve out for multihypo cases, see issue 427.
Development Notes:
- Target factor is first (singletons) or second (dim 2 pairwise) variable vertex in
xi
. - TODO use DFG properly with local operations and DB update at end.
- TODO get faster version of
isInitialized
for database version. - TODO: Persist this back if we want to here.
- TODO: init from just partials
IncrementalInference.drawCliqSubgraphUpMocking
— FunctiondrawCliqSubgraphUpMocking(
fgl,
treel,
frontalSym;
show,
filepath,
engine,
viewerapp
)
Construct (new) subgraph and draw the subgraph associated with clique frontalSym::Symbol
.
Notes
- See
drawGraphCliq
/writeGraphPdf
for details on keyword options.
Related
drawGraphCliq, spyCliqMat, drawTree, buildCliqSubgraphUp, buildSubgraphFromLabels!
IncrementalInference.fifoFreeze!
— FunctionfifoFreeze!(dfg)
Freeze nodes that are older than the quasi fixed-lag length defined by fg.qfl
, according to fg.fifo
ordering.
Future:
- Allow different freezing strategies beyond fifo.
IncrementalInference.filterHistAllToArray
— FunctionfilterHistAllToArray(tree, hists, frontals, nextfnc)
Return state machine transition steps from all cliq histories with transition nextfnc::Function
.
Related:
printCliqHistorySummary, cliqHistFilterTransitions, sandboxCliqResolveStep
IncrementalInference.fmcmc!
— Functionfmcmc!(fgl, cliq, fmsgs, lbls, solveKey, N, MCMCIter)
fmcmc!(fgl, cliq, fmsgs, lbls, solveKey, N, MCMCIter, dbg)
fmcmc!(
fgl,
cliq,
fmsgs,
lbls,
solveKey,
N,
MCMCIter,
dbg,
logger
)
fmcmc!(
fgl,
cliq,
fmsgs,
lbls,
solveKey,
N,
MCMCIter,
dbg,
logger,
multithreaded
)
Iterate successive approximations of clique marginal beliefs by means of the stipulated proposal convolutions and products of the functional objects for tree clique cliq
.
IncrementalInference.getClique
— FunctiongetClique(tree, cId)
Return the TreeClique node object that represents a clique in the Bayes (Junction) tree, as defined by one of the frontal variables frt<:AbstractString
.
Notes
- Frontal variables only occur once in a clique per tree, therefore is a unique identifier.
Related:
getCliq, getTreeAllFrontalSyms
IncrementalInference.getCliqAllVarIds
— FunctiongetCliqAllVarIds(cliq)
Get all cliq
variable ids::Symbol
.
Related
getCliqVarIdsAll, getCliqFactorIdsAll, getCliqVarsWithFrontalNeighbors
IncrementalInference.getCliqAssocMat
— FunctiongetCliqAssocMat(cliq)
Return boolean matrix of factor by variable (row by column) associations within clique, corresponds to order presented by getCliqFactorIds
and getCliqAllVarIds
.
IncrementalInference.getCliqDepth
— FunctiongetCliqDepth(tree, cliq)
Return depth in tree as ::Int
, with root as depth=0.
Related
getCliq
IncrementalInference.getCliqDownMsgsAfterDownSolve
— FunctiongetCliqDownMsgsAfterDownSolve(
subdfg,
cliq,
solveKey;
status,
sender
)
Return dictionary of down messages consisting of all frontal and separator beliefs of this clique.
Notes:
- Fetches numerical results from
subdfg
as dictated incliq
. - return LikelihoodMessage
IncrementalInference.getCliqFrontalVarIds
— FunctiongetCliqFrontalVarIds(cliqdata)
Get the frontal variable IDs ::Int
for a given clique in a Bayes (Junction) tree.
IncrementalInference.getCliqVarInitOrderUp
— FunctiongetCliqVarInitOrderUp(subfg)
Return the most likely ordering for initializing factor (assuming up solve sequence).
Notes:
- sorts id (label) for increasing number of connected factors using the clique subfg with messages already included.
IncrementalInference.getCliqMat
— FunctiongetCliqMat(cliq; showmsg)
Return boolean matrix of factor variable associations for a clique, optionally including (showmsg::Bool=true
) the upward message singletons. Variable order corresponds to getCliqAllVarIds
.
IncrementalInference.getCliqSeparatorVarIds
— FunctiongetCliqSeparatorVarIds(cliqdata)
Get cliq
separator (a.k.a. conditional) variable ids::Symbol
.
IncrementalInference.getCliqSiblings
— FunctiongetCliqSiblings(treel, cliq)
getCliqSiblings(treel, cliq, inclusive)
Return a vector of all siblings to a clique, which defaults to not inclusive
the calling cliq
.
IncrementalInference.getCliqVarIdsPriors
— FunctiongetCliqVarIdsPriors(cliq)
getCliqVarIdsPriors(cliq, allids)
getCliqVarIdsPriors(cliq, allids, partials)
Get variable ids::Int
with prior factors associated with this cliq
.
Notes:
- does not include any singleton messages from upward or downward message passing.
IncrementalInference.getCliqVarSingletons
— FunctiongetCliqVarSingletons(cliq)
getCliqVarSingletons(cliq, allids)
getCliqVarSingletons(cliq, allids, partials)
Get cliq
variable IDs with singleton factors – i.e. both in clique priors and up messages.
IncrementalInference.getParent
— FunctiongetParent(treel, afrontal)
Return cliq
's parent clique.
IncrementalInference.getTreeAllFrontalSyms
— FunctiongetTreeAllFrontalSyms(_, tree)
Return one symbol (a frontal variable) from each clique in the ::BayesTree
.
Notes
- Frontal variables only occur once in a clique per tree, therefore is a unique identifier.
Related:
whichCliq, printCliqHistorySummary
IncrementalInference.hasClique
— FunctionhasClique(bt, frt)
Return boolean on whether the frontal variable frt::Symbol
exists somewhere in the ::BayesTree
.
DistributedFactorGraphs.isInitialized
— FunctionisInitialized(var)
isInitialized(var, key)
Returns state of variable data .initialized
flag.
Notes:
- used by both factor graph variable and Bayes tree clique logic.
isInitialized(cliq)
Returns state of Bayes tree clique .initialized
flag.
Notes:
- used by Bayes tree clique logic.
- similar method in DFG
DistributedFactorGraphs.isMarginalized
— FunctionisMarginalized(vert)
isMarginalized(vert, solveKey)
Return ::Bool
on whether this variable has been marginalized.
Notes:
- VariableNodeData default
solveKey=:default
IncrementalInference.isTreeSolved
— FunctionisTreeSolved(treel; skipinitialized)
Return true or false depending on whether the tree has been fully initialized/solved/marginalized.
ApproxManifoldProducts.isPartial
— FunctionisPartial(fcf)
Return ::Bool
on whether factor is a partial constraint.
IncrementalInference.localProduct
— FunctionlocalProduct(dfg, sym; solveKey, N, dbg, logger)
Using factor graph object dfg
, project belief through connected factors (convolution with likelihood) to variable sym
followed by a approximate functional product.
Return: product belief, full proposals, partial dimension proposals, labels
IncrementalInference.makeCsmMovie
— FunctionmakeCsmMovie(fg, tree; ...)
makeCsmMovie(
fg,
tree,
cliqs;
assignhist,
show,
filename,
frames
)
Convenience function to assign and make video of CSM state machine for cliqs
.
Notes
- Probably several teething issues still (lower priority).
- Use
assignhist
if solver params async was true, or errored.
Related
csmAnimate, printCliqHistorySummary
IncrementalInference.parentCliq
— FunctionparentCliq(treel, cliq)
Return cliq
's parent clique.
RoME.predictVariableByFactor
— FunctionpredictVariableByFactor(dfg, targetsym, fct, prevars)
Method to compare current and predicted estimate on a variable, developed for testing a new factor before adding to the factor graph.
Notes
fct
does not have to be in the factor graph – likely used to test beforehand.- function is useful for detecting if
multihypo
should be used. approxConv
will project the full belief estimate through some factor but must already be in factor graph.
Example
# fg already exists containing :x7 and :l3
pp = Pose2Point2BearingRange(Normal(0,0.1),Normal(10,1.0))
# possible new measurement from :x7 to :l3
curr, pred = predictVariableByFactor(fg, :l3, pp, [:x7; :l3])
# example of naive user defined test on fit score
fitscore = minkld(curr, pred)
# `multihypo` can be used as option between existing or new variables
Related
approxConv
IncrementalInference.printCliqHistorySummary
— FunctionprintCliqHistorySummary(fid, hist)
printCliqHistorySummary(fid, hist, cliqid)
Print a short summary of state machine history for a clique solve.
Related:
getTreeAllFrontalSyms, animateCliqStateMachines, printHistoryLine, printCliqHistorySequential
IncrementalInference.resetCliqSolve!
— FunctionresetCliqSolve!(dfg, treel, cliq; solveKey)
Reset the state of all variables in a clique to not initialized.
Notes
- resets numberical values to zeros.
Dev Notes
- TODO not all kde manifolds will initialize to zero.
- FIXME channels need to be consolidated
IncrementalInference.resetData!
— FunctionresetData!(vdata)
Partial reset of basic data fields in ::VariableNodeData
of ::FunctionNode
structures.
IncrementalInference.resetTreeCliquesForUpSolve!
— FunctionresetTreeCliquesForUpSolve!(treel)
Reset the Bayes (Junction) tree so that a new upsolve can be performed.
Notes
- Will change previous clique status from
DOWNSOLVED
toINITIALIZED
only. - Sets the color of tree clique to
lightgreen
.
IncrementalInference.resetVariable!
— FunctionresetVariable!(varid; solveKey)
Reset the solve state of a variable to uninitialized/unsolved state.
IncrementalInference.setfreeze!
— Functionsetfreeze!(dfg, sym)
Set variable(s) sym
of factor graph to be marginalized – i.e. not be updated by inference computation.
IncrementalInference.setValKDE!
— FunctionsetValKDE!(vd, pts, bws)
setValKDE!(vd, pts, bws, setinit)
setValKDE!(vd, pts, bws, setinit, ipc)
Set the point centers and bandwidth parameters of a variable node, also set isInitialized=true
if setinit::Bool=true
(as per default).
Notes
initialized
is used for initial solve of factor graph where variables are not yet initialized.inferdim
is used to identify if the initialized was only partial.
IncrementalInference.setVariableInitialized!
— FunctionsetVariableInitialized!(varid, status)
Set variable initialized status.
IncrementalInference.solveCliqWithStateMachine!
— FunctionsolveCliqWithStateMachine!(
dfg,
tree,
frontal;
iters,
downsolve,
recordhistory,
verbose,
nextfnc,
prevcsmc
)
Standalone state machine solution for a single clique.
Related:
initInferTreeUp!
IncrementalInference.transferUpdateSubGraph!
— FunctiontransferUpdateSubGraph!(dest, src; ...)
transferUpdateSubGraph!(dest, src, syms; ...)
transferUpdateSubGraph!(
dest,
src,
syms,
logger;
updatePPE,
solveKey
)
Transfer contents of src::AbstractDFG
variables syms::Vector{Symbol}
to dest::AbstractDFG
. Notes
- Reads,
dest
:=src
, for allsyms
IncrementalInference.treeProductDwn
— FunctiontreeProductDwn(fg, tree, cliq, sym; N, dbg)
Calculate a fresh–-single step–-approximation to the variable sym
in clique cliq
as though during the downward message passing. The full inference algorithm may repeatedly calculate successive apprimxations to the variable based on the structure of variables, factors, and incoming messages to this clique. Which clique to be used is defined by frontal variable symbols (cliq
in this case) – see getClique(...)
for more details. The sym
symbol indicates which symbol of this clique to be calculated. Note that the sym
variable must appear in the clique where cliq
is a frontal variable.
IncrementalInference.treeProductUp
— FunctiontreeProductUp(fg, tree, cliq, sym; N, dbg)
Calculate a fresh (single step) approximation to the variable sym
in clique cliq
as though during the upward message passing. The full inference algorithm may repeatedly calculate successive apprimxations to the variables based on the structure of the clique, factors, and incoming messages. Which clique to be used is defined by frontal variable symbols (cliq
in this case) – see getClique(...)
for more details. The sym
symbol indicates which symbol of this clique to be calculated. Note that the sym
variable must appear in the clique where cliq
is a frontal variable.
IncrementalInference.unfreezeVariablesAll!
— FunctionunfreezeVariablesAll!(fgl)
Free all variables from marginalization.
Related
dontMarginalizeVariablesAll!
IncrementalInference.dontMarginalizeVariablesAll!
— FunctiondontMarginalizeVariablesAll!(fgl)
Free all variables from marginalization.
IncrementalInference.updateFGBT!
— FunctionupdateFGBT!(fg, cliq, IDvals; dbg, fillcolor, logger)
Update cliq cliqID
in Bayes (Juction) tree bt
according to contents of urt
. Intended use is to update main clique after a upward belief propagation computation has been completed per clique.
IncrementalInference.upGibbsCliqueDensity
— FunctionupGibbsCliqueDensity(dfg, cliq, solveKey, inmsgs)
upGibbsCliqueDensity(dfg, cliq, solveKey, inmsgs, N)
upGibbsCliqueDensity(dfg, cliq, solveKey, inmsgs, N, dbg)
upGibbsCliqueDensity(
dfg,
cliq,
solveKey,
inmsgs,
N,
dbg,
iters
)
upGibbsCliqueDensity(
dfg,
cliq,
solveKey,
inmsgs,
N,
dbg,
iters,
logger
)
Perform computations required for the upward message passing during belief propation on the Bayes (Junction) tree. This function is usually called as via remote_call for multiprocess dispatch.
Notes
fg
factor graph,tree
Bayes tree,cliq
which cliq to perform the computation on,parent
the parent clique to where the upward message will be sent,childmsgs
is for any incoming messages from child cliques.
DevNotes
- FIXME total rewrite with AMP #41 and RoME #244 in mind
IncrementalInference.resetVariableAllInitializations!
— FunctionresetVariableAllInitializations!(fgl)
Reset initialization flag on all variables in ::AbstractDFG
.
Notes
- Numerical values remain, but inference will overwrite since init flags are now
false
.