Parametric Solve (Experimental)

Note that parametric solve (i.e. conventional Gaussians) is currently supported as an experimental feature which might appear more buggy. Familiar parametric methods should become fully integrated and we invite comments or contributions from the community. A great deal of effort has gone into finding the best abstractions to support multiple factor graph solving strategies.

Batch Parametric

IncrementalInference.solveGraphParametricFunction
solveGraphParametric(fg; solvekey, autodiff, algorithm, algorithmkwargs, options)

Batch solve a Gaussian factor graph using Optim.jl. Parameters can be passed directly to optim. Notes:

  • Only :Euclid and :Circular manifolds are currently supported, own manifold are supported with algorithmkwargs (code may need updating though)

Initializing the parametric solve from existing values can be done with the help of:

Missing docstring.

Missing docstring for initParametricFrom!. Check Documenter's build log for details.

Defining Factors to Support a Parametric Solution (Experimental)

Factor that supports a parametric solution, with supported distributions (such as Normal and MvNormal), can be used in a parametric batch solver solveGraphParametric.

getParametricMeasurement

Parameteric calculations require the mean and covariance from Gaussian measurement functions (factors) using the function

Missing docstring.

Missing docstring for IncrementalInference.getParametricMeasurement. Check Documenter's build log for details.

getParametricMeasurement defaults to looking for a supported distribution in field .Z followed by .z. Therefore, if the factor uses this fieldname, getParametricMeasurement does not need to be extended. You can extend by simply implementing, for example, your own IncrementalInference.getParametricMeasurement(f::OtherFactor) = m.density.

For this example, the Z field will automatically be detected used by default for MyFactor from above.

struct MyFactor{T <: SamplableBelief} <: IIF.AbstractRelativeRoots
  Z::T
end

An example of where implementing getParametricMeasurement is needed can be found in the RoME factor Pose2Point2BearingRange

import getParametricMeasurement
function getParametricMeasurement(s::Pose2Point2BearingRange{<:Normal, <:Normal})

  meas = [mean(s.bearing), mean(s.range)]
  iΣ = [1/var(s.bearing)             0;
                      0  1/var(s.range)]

  return meas, iΣ
end

The Factor

The factor is evaluated in a cost function using the Mahalanobis distance and the measurement should therefore match the residual returned.

Optimization

IncrementalInference.solveGraphParametric! uses Optim.jl. The factors that are supported should have a gradient and Hessian available/exists and therefore it makes use of TwiceDifferentiable. Full control of Optim's setup is possible with keyword arguments.