26 #include <boost/optional.hpp> 38 SILENT, TERMINATION, ERROR, VALUES, DELTA, LINEAR
49 maxIterations(100), relativeErrorTol(1e-5), absoluteErrorTol(1e-5), errorTol(
50 0.0), verbosity(SILENT), orderingType(
Ordering::COLAMD),
51 linearSolverType(MULTIFRONTAL_CHOLESKY) {}
55 virtual void print(
const std::string& str =
"")
const;
57 size_t getMaxIterations()
const {
return maxIterations; }
58 double getRelativeErrorTol()
const {
return relativeErrorTol; }
59 double getAbsoluteErrorTol()
const {
return absoluteErrorTol; }
60 double getErrorTol()
const {
return errorTol; }
61 std::string getVerbosity()
const {
return verbosityTranslator(verbosity); }
63 void setMaxIterations(
int value) { maxIterations = value; }
64 void setRelativeErrorTol(
double value) { relativeErrorTol = value; }
65 void setAbsoluteErrorTol(
double value) { absoluteErrorTol = value; }
66 void setErrorTol(
double value) { errorTol = value; }
67 void setVerbosity(
const std::string& src) {
68 verbosity = verbosityTranslator(src);
71 static Verbosity verbosityTranslator(
const std::string &s) ;
72 static std::string verbosityTranslator(Verbosity value) ;
76 MULTIFRONTAL_CHOLESKY,
88 inline bool isMultifrontal()
const {
89 return (linearSolverType == MULTIFRONTAL_CHOLESKY)
90 || (linearSolverType == MULTIFRONTAL_QR);
93 inline bool isSequential()
const {
94 return (linearSolverType == SEQUENTIAL_CHOLESKY)
95 || (linearSolverType == SEQUENTIAL_QR);
98 inline bool isCholmod()
const {
99 return (linearSolverType == CHOLMOD);
102 inline bool isIterative()
const {
103 return (linearSolverType == Iterative);
107 switch (linearSolverType) {
108 case MULTIFRONTAL_CHOLESKY:
109 case SEQUENTIAL_CHOLESKY:
110 return EliminatePreferCholesky;
112 case MULTIFRONTAL_QR:
117 throw std::runtime_error(
118 "Nonlinear optimization parameter \"factorization\" is invalid");
122 std::string getLinearSolverType()
const {
123 return linearSolverTranslator(linearSolverType);
126 void setLinearSolverType(
const std::string& solver) {
127 linearSolverType = linearSolverTranslator(solver);
130 void setIterativeParams(
const boost::shared_ptr<IterativeOptimizationParameters> params);
132 void setOrdering(
const Ordering& ordering) {
133 this->ordering = ordering;
134 this->orderingType = Ordering::CUSTOM;
137 std::string getOrderingType()
const {
138 return orderingTypeTranslator(orderingType);
142 void setOrderingType(
const std::string& ordering){
143 orderingType = orderingTypeTranslator(ordering);
147 std::string linearSolverTranslator(LinearSolverType linearSolverType)
const;
148 LinearSolverType linearSolverTranslator(
const std::string& linearSolverType)
const;
154 typedef NonlinearOptimizerParams SuccessiveLinearizationParams;
double absoluteErrorTol
The maximum absolute error decrease to stop iterating (default 1e-5)
Definition: NonlinearOptimizerParams.h:43
LinearSolverType linearSolverType
The type of linear solver to use in the nonlinear optimizer.
Definition: NonlinearOptimizerParams.h:84
Ordering::OrderingType orderingType
The method of ordering use during variable elimination (default COLAMD)
Definition: NonlinearOptimizerParams.h:46
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
LinearSolverType
See NonlinearOptimizerParams::linearSolverType.
Definition: NonlinearOptimizerParams.h:75
size_t maxIterations
The maximum iterations to stop iterating (default 100)
Definition: NonlinearOptimizerParams.h:41
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:721
Verbosity
See NonlinearOptimizerParams::verbosity.
Definition: NonlinearOptimizerParams.h:37
boost::optional< Ordering > ordering
The variable elimination ordering, or empty to use COLAMD (default: empty)
Definition: NonlinearOptimizerParams.h:85
double errorTol
The maximum total error to stop iterating (default 0.0)
Definition: NonlinearOptimizerParams.h:44
Verbosity verbosity
The printing verbosity during optimization (default SILENT)
Definition: NonlinearOptimizerParams.h:45
OrderingType
Type of ordering to use.
Definition: Ordering.h:41
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Subgraph Solver from IROS 2010.
The common parameters for Nonlinear optimizers.
Definition: NonlinearOptimizerParams.h:34
Linear Factor Graph where all factors are Gaussians.
boost::function< EliminationResult(const FactorGraphType &, const Ordering &)> Eliminate
The function type that does a single dense elimination step on a subgraph.
Definition: EliminateableFactorGraph.h:89
IterativeOptimizationParameters::shared_ptr iterativeParams
The container for iterativeOptimization parameters. used in CG Solvers.
Definition: NonlinearOptimizerParams.h:86
Definition: Ordering.h:34
double relativeErrorTol
The maximum relative error decrease to stop iterating (default 1e-5)
Definition: NonlinearOptimizerParams.h:42