26#include <boost/optional.hpp>
38 SILENT, TERMINATION, ERROR, VALUES, DELTA, LINEAR
41 size_t maxIterations = 100;
42 double relativeErrorTol = 1e-5;
43 double absoluteErrorTol = 1e-5;
44 double errorTol = 0.0;
48 size_t getMaxIterations()
const {
return maxIterations; }
49 double getRelativeErrorTol()
const {
return relativeErrorTol; }
50 double getAbsoluteErrorTol()
const {
return absoluteErrorTol; }
51 double getErrorTol()
const {
return errorTol; }
52 std::string getVerbosity()
const {
return verbosityTranslator(verbosity); }
54 void setMaxIterations(
int value) { maxIterations = value; }
55 void setRelativeErrorTol(
double value) { relativeErrorTol = value; }
56 void setAbsoluteErrorTol(
double value) { absoluteErrorTol = value; }
57 void setErrorTol(
double value) { errorTol = value; }
58 void setVerbosity(
const std::string& src) {
59 verbosity = verbosityTranslator(src);
62 static Verbosity verbosityTranslator(
const std::string &s) ;
63 static std::string verbosityTranslator(Verbosity value) ;
68 void(
size_t ,
double,
double)>;
98 MULTIFRONTAL_CHOLESKY,
114 virtual void print(
const std::string& str =
"")
const;
117 return maxIterations == other.getMaxIterations()
118 && std::abs(relativeErrorTol - other.getRelativeErrorTol()) <= tol
119 && std::abs(absoluteErrorTol - other.getAbsoluteErrorTol()) <= tol
120 && std::abs(errorTol - other.getErrorTol()) <= tol
121 && verbosityTranslator(verbosity) == other.getVerbosity();
127 inline bool isMultifrontal()
const {
128 return (linearSolverType == MULTIFRONTAL_CHOLESKY)
129 || (linearSolverType == MULTIFRONTAL_QR);
132 inline bool isSequential()
const {
133 return (linearSolverType == SEQUENTIAL_CHOLESKY)
134 || (linearSolverType == SEQUENTIAL_QR);
137 inline bool isCholmod()
const {
138 return (linearSolverType == CHOLMOD);
141 inline bool isIterative()
const {
142 return (linearSolverType == Iterative);
146 switch (linearSolverType) {
147 case MULTIFRONTAL_CHOLESKY:
148 case SEQUENTIAL_CHOLESKY:
149 return EliminatePreferCholesky;
151 case MULTIFRONTAL_QR:
156 throw std::runtime_error(
157 "Nonlinear optimization parameter \"factorization\" is invalid");
161 std::string getLinearSolverType()
const {
162 return linearSolverTranslator(linearSolverType);
165 void setLinearSolverType(
const std::string& solver) {
166 linearSolverType = linearSolverTranslator(solver);
169 void setIterativeParams(
const boost::shared_ptr<IterativeOptimizationParameters> params);
171 void setOrdering(
const Ordering& ordering) {
172 this->ordering = ordering;
173 this->orderingType = Ordering::CUSTOM;
176 std::string getOrderingType()
const {
177 return orderingTypeTranslator(orderingType);
181 void setOrderingType(
const std::string& ordering){
182 orderingType = orderingTypeTranslator(ordering);
186 std::string linearSolverTranslator(LinearSolverType linearSolverType)
const;
187 LinearSolverType linearSolverTranslator(
const std::string& linearSolverType)
const;
193typedef NonlinearOptimizerParams SuccessiveLinearizationParams;
Subgraph Solver from IROS 2010.
Linear Factor Graph where all factors are Gaussians.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:155
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
Multiply all factors and eliminate the given keys from the resulting factor using a QR variant that h...
Definition: JacobianFactor.cpp:789
Template to create a binary predicate.
Definition: Testable.h:111
std::function< EliminationResult(const FactorGraphType &, const Ordering &)> Eliminate
The function type that does a single dense elimination step on a subgraph.
Definition: EliminateableFactorGraph.h:89
OrderingType
Type of ordering to use.
Definition: Ordering.h:41
The common parameters for Nonlinear optimizers.
Definition: NonlinearOptimizerParams.h:34
IterationHook iterationHook
Optional user-provided iteration hook to be called after each optimization iteration (Default: none).
Definition: NonlinearOptimizerParams.h:94
IterativeOptimizationParameters::shared_ptr iterativeParams
The container for iterativeOptimization parameters. used in CG Solvers.
Definition: NonlinearOptimizerParams.h:108
Verbosity
See NonlinearOptimizerParams::verbosity.
Definition: NonlinearOptimizerParams.h:37
LinearSolverType
See NonlinearOptimizerParams::linearSolverType.
Definition: NonlinearOptimizerParams.h:97
std::function< void(size_t, double, double)> IterationHook
Type for an optional user-provided hook to be called after each internal optimizer iteration.
Definition: NonlinearOptimizerParams.h:68
boost::optional< Ordering > ordering
The optional variable elimination ordering, or empty to use COLAMD (default: empty)
Definition: NonlinearOptimizerParams.h:107