Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
gtsam::NonlinearOptimizerParams Class Reference

#include <NonlinearOptimizerParams.h>

Inheritance diagram for gtsam::NonlinearOptimizerParams:
Inheritance graph
[legend]

Public Types

using IterationHook = std::function< void(size_t, double, double)>
 
enum  LinearSolverType {
  MULTIFRONTAL_CHOLESKY, MULTIFRONTAL_QR, SEQUENTIAL_CHOLESKY, SEQUENTIAL_QR,
  Iterative, CHOLMOD
}
 
enum  Verbosity {
  SILENT, TERMINATION, ERROR, VALUES,
  DELTA, LINEAR
}
 

Public Member Functions

bool equals (const NonlinearOptimizerParams &other, double tol=1e-9) const
 
double getAbsoluteErrorTol () const
 
GaussianFactorGraph::Eliminate getEliminationFunction () const
 
double getErrorTol () const
 
std::string getLinearSolverType () const
 
size_t getMaxIterations () const
 
std::string getOrderingType () const
 
double getRelativeErrorTol () const
 
std::string getVerbosity () const
 
bool isCholmod () const
 
bool isIterative () const
 
bool isMultifrontal () const
 
bool isSequential () const
 
 NonlinearOptimizerParams ()=default
 
virtual void print (const std::string &str="") const
 
void setAbsoluteErrorTol (double value)
 
void setErrorTol (double value)
 
void setIterativeParams (const std::shared_ptr< IterativeOptimizationParameters > params)
 
void setLinearSolverType (const std::string &solver)
 
void setMaxIterations (int value)
 
void setOrdering (const Ordering &ordering)
 
void setOrderingType (const std::string &ordering)
 
void setRelativeErrorTol (double value)
 
void setVerbosity (const std::string &src)
 
virtual ~NonlinearOptimizerParams ()
 

Static Public Member Functions

static Verbosity verbosityTranslator (const std::string &s)
 
static std::string verbosityTranslator (Verbosity value)
 

Public Attributes

double absoluteErrorTol = 1e-5
 The maximum absolute error decrease to stop iterating (default 1e-5) More...
 
double errorTol = 0.0
 The maximum total error to stop iterating (default 0.0) More...
 
IterationHook iterationHook
 
IterativeOptimizationParameters::shared_ptr iterativeParams
 The container for iterativeOptimization parameters. used in CG Solvers. More...
 
LinearSolverType linearSolverType = MULTIFRONTAL_CHOLESKY
 The type of linear solver to use in the nonlinear optimizer. More...
 
size_t maxIterations = 100
 The maximum iterations to stop iterating (default 100) More...
 
std::optional< Orderingordering
 The optional variable elimination ordering, or empty to use COLAMD (default: empty) More...
 
Ordering::OrderingType orderingType = Ordering::COLAMD
 The method of ordering use during variable elimination (default COLAMD) More...
 
double relativeErrorTol = 1e-5
 The maximum relative error decrease to stop iterating (default 1e-5) More...
 
Verbosity verbosity = SILENT
 The printing verbosity during optimization (default SILENT) More...
 

Private Member Functions

std::string linearSolverTranslator (LinearSolverType linearSolverType) const
 
LinearSolverType linearSolverTranslator (const std::string &linearSolverType) const
 
std::string orderingTypeTranslator (Ordering::OrderingType type) const
 
Ordering::OrderingType orderingTypeTranslator (const std::string &type) const
 

Detailed Description

The common parameters for Nonlinear optimizers. Most optimizers deriving from NonlinearOptimizer also subclass the parameters.

Definition at line 35 of file NonlinearOptimizerParams.h.

Member Typedef Documentation

◆ IterationHook

using gtsam::NonlinearOptimizerParams::IterationHook = std::function< void(size_t , double, double)>

Type for an optional user-provided hook to be called after each internal optimizer iteration. See iterationHook below.

Definition at line 69 of file NonlinearOptimizerParams.h.

Member Enumeration Documentation

◆ LinearSolverType

See NonlinearOptimizerParams::linearSolverType

Enumerator
MULTIFRONTAL_CHOLESKY 
MULTIFRONTAL_QR 
SEQUENTIAL_CHOLESKY 
SEQUENTIAL_QR 
Iterative 
CHOLMOD 

Definition at line 98 of file NonlinearOptimizerParams.h.

◆ Verbosity

See NonlinearOptimizerParams::verbosity

Enumerator
SILENT 
TERMINATION 
ERROR 
VALUES 
DELTA 
LINEAR 

Definition at line 38 of file NonlinearOptimizerParams.h.

Constructor & Destructor Documentation

◆ NonlinearOptimizerParams()

gtsam::NonlinearOptimizerParams::NonlinearOptimizerParams ( )
default

◆ ~NonlinearOptimizerParams()

virtual gtsam::NonlinearOptimizerParams::~NonlinearOptimizerParams ( )
inlinevirtual

Definition at line 112 of file NonlinearOptimizerParams.h.

Member Function Documentation

◆ equals()

bool gtsam::NonlinearOptimizerParams::equals ( const NonlinearOptimizerParams other,
double  tol = 1e-9 
) const
inline

Definition at line 117 of file NonlinearOptimizerParams.h.

◆ getAbsoluteErrorTol()

double gtsam::NonlinearOptimizerParams::getAbsoluteErrorTol ( ) const
inline

Definition at line 51 of file NonlinearOptimizerParams.h.

◆ getEliminationFunction()

GaussianFactorGraph::Eliminate gtsam::NonlinearOptimizerParams::getEliminationFunction ( ) const
inline

Definition at line 146 of file NonlinearOptimizerParams.h.

◆ getErrorTol()

double gtsam::NonlinearOptimizerParams::getErrorTol ( ) const
inline

Definition at line 52 of file NonlinearOptimizerParams.h.

◆ getLinearSolverType()

std::string gtsam::NonlinearOptimizerParams::getLinearSolverType ( ) const
inline

Definition at line 162 of file NonlinearOptimizerParams.h.

◆ getMaxIterations()

size_t gtsam::NonlinearOptimizerParams::getMaxIterations ( ) const
inline

Definition at line 49 of file NonlinearOptimizerParams.h.

◆ getOrderingType()

std::string gtsam::NonlinearOptimizerParams::getOrderingType ( ) const
inline

Definition at line 177 of file NonlinearOptimizerParams.h.

◆ getRelativeErrorTol()

double gtsam::NonlinearOptimizerParams::getRelativeErrorTol ( ) const
inline

Definition at line 50 of file NonlinearOptimizerParams.h.

◆ getVerbosity()

std::string gtsam::NonlinearOptimizerParams::getVerbosity ( ) const
inline

Definition at line 53 of file NonlinearOptimizerParams.h.

◆ isCholmod()

bool gtsam::NonlinearOptimizerParams::isCholmod ( ) const
inline

Definition at line 138 of file NonlinearOptimizerParams.h.

◆ isIterative()

bool gtsam::NonlinearOptimizerParams::isIterative ( ) const
inline

Definition at line 142 of file NonlinearOptimizerParams.h.

◆ isMultifrontal()

bool gtsam::NonlinearOptimizerParams::isMultifrontal ( ) const
inline

Definition at line 128 of file NonlinearOptimizerParams.h.

◆ isSequential()

bool gtsam::NonlinearOptimizerParams::isSequential ( ) const
inline

Definition at line 133 of file NonlinearOptimizerParams.h.

◆ linearSolverTranslator() [1/2]

std::string gtsam::NonlinearOptimizerParams::linearSolverTranslator ( LinearSolverType  linearSolverType) const
private

Definition at line 127 of file NonlinearOptimizerParams.cpp.

◆ linearSolverTranslator() [2/2]

NonlinearOptimizerParams::LinearSolverType gtsam::NonlinearOptimizerParams::linearSolverTranslator ( const std::string &  linearSolverType) const
private

Definition at line 149 of file NonlinearOptimizerParams.cpp.

◆ orderingTypeTranslator() [1/2]

std::string gtsam::NonlinearOptimizerParams::orderingTypeTranslator ( Ordering::OrderingType  type) const
private

Definition at line 168 of file NonlinearOptimizerParams.cpp.

◆ orderingTypeTranslator() [2/2]

Ordering::OrderingType gtsam::NonlinearOptimizerParams::orderingTypeTranslator ( const std::string &  type) const
private

Definition at line 185 of file NonlinearOptimizerParams.cpp.

◆ print()

void gtsam::NonlinearOptimizerParams::print ( const std::string &  str = "") const
virtual

Reimplemented in gtsam::LevenbergMarquardtParams, and gtsam::DoglegParams.

Definition at line 75 of file NonlinearOptimizerParams.cpp.

◆ setAbsoluteErrorTol()

void gtsam::NonlinearOptimizerParams::setAbsoluteErrorTol ( double  value)
inline

Definition at line 57 of file NonlinearOptimizerParams.h.

◆ setErrorTol()

void gtsam::NonlinearOptimizerParams::setErrorTol ( double  value)
inline

Definition at line 58 of file NonlinearOptimizerParams.h.

◆ setIterativeParams()

void gtsam::NonlinearOptimizerParams::setIterativeParams ( const std::shared_ptr< IterativeOptimizationParameters params)

Definition at line 69 of file NonlinearOptimizerParams.cpp.

◆ setLinearSolverType()

void gtsam::NonlinearOptimizerParams::setLinearSolverType ( const std::string &  solver)
inline

Definition at line 166 of file NonlinearOptimizerParams.h.

◆ setMaxIterations()

void gtsam::NonlinearOptimizerParams::setMaxIterations ( int  value)
inline

Definition at line 55 of file NonlinearOptimizerParams.h.

◆ setOrdering()

void gtsam::NonlinearOptimizerParams::setOrdering ( const Ordering ordering)
inline

Definition at line 172 of file NonlinearOptimizerParams.h.

◆ setOrderingType()

void gtsam::NonlinearOptimizerParams::setOrderingType ( const std::string &  ordering)
inline

Definition at line 182 of file NonlinearOptimizerParams.h.

◆ setRelativeErrorTol()

void gtsam::NonlinearOptimizerParams::setRelativeErrorTol ( double  value)
inline

Definition at line 56 of file NonlinearOptimizerParams.h.

◆ setVerbosity()

void gtsam::NonlinearOptimizerParams::setVerbosity ( const std::string &  src)
inline

Definition at line 59 of file NonlinearOptimizerParams.h.

◆ verbosityTranslator() [1/2]

NonlinearOptimizerParams::Verbosity gtsam::NonlinearOptimizerParams::verbosityTranslator ( const std::string &  s)
static

Definition at line 16 of file NonlinearOptimizerParams.cpp.

◆ verbosityTranslator() [2/2]

std::string gtsam::NonlinearOptimizerParams::verbosityTranslator ( Verbosity  value)
static

Definition at line 39 of file NonlinearOptimizerParams.cpp.

Member Data Documentation

◆ absoluteErrorTol

double gtsam::NonlinearOptimizerParams::absoluteErrorTol = 1e-5

The maximum absolute error decrease to stop iterating (default 1e-5)

Definition at line 44 of file NonlinearOptimizerParams.h.

◆ errorTol

double gtsam::NonlinearOptimizerParams::errorTol = 0.0

The maximum total error to stop iterating (default 0.0)

Definition at line 45 of file NonlinearOptimizerParams.h.

◆ iterationHook

IterationHook gtsam::NonlinearOptimizerParams::iterationHook

Optional user-provided iteration hook to be called after each optimization iteration (Default: none). Note that IterationHook is defined as a std::function<> with this signature:

void(size_t iteration, double errorBefore, double errorAfter)

which allows binding by means of a reference to a regular function:

void foo(size_t iteration, double errorBefore, double errorAfter);
// ...
lmOpts.iterationHook = &foo;

or to a C++11 lambda (preferred if you need to capture additional context variables, such that the optimizer object itself, the factor graph, etc.):

lmOpts.iterationHook = [&](size_t iter, double oldError, double newError)
{
// ...
};

or to the result of a properly-formed std::bind call.

Definition at line 95 of file NonlinearOptimizerParams.h.

◆ iterativeParams

IterativeOptimizationParameters::shared_ptr gtsam::NonlinearOptimizerParams::iterativeParams

The container for iterativeOptimization parameters. used in CG Solvers.

Definition at line 109 of file NonlinearOptimizerParams.h.

◆ linearSolverType

LinearSolverType gtsam::NonlinearOptimizerParams::linearSolverType = MULTIFRONTAL_CHOLESKY

The type of linear solver to use in the nonlinear optimizer.

Definition at line 107 of file NonlinearOptimizerParams.h.

◆ maxIterations

size_t gtsam::NonlinearOptimizerParams::maxIterations = 100

The maximum iterations to stop iterating (default 100)

Definition at line 42 of file NonlinearOptimizerParams.h.

◆ ordering

std::optional<Ordering> gtsam::NonlinearOptimizerParams::ordering

The optional variable elimination ordering, or empty to use COLAMD (default: empty)

Definition at line 108 of file NonlinearOptimizerParams.h.

◆ orderingType

Ordering::OrderingType gtsam::NonlinearOptimizerParams::orderingType = Ordering::COLAMD

The method of ordering use during variable elimination (default COLAMD)

Definition at line 47 of file NonlinearOptimizerParams.h.

◆ relativeErrorTol

double gtsam::NonlinearOptimizerParams::relativeErrorTol = 1e-5

The maximum relative error decrease to stop iterating (default 1e-5)

Definition at line 43 of file NonlinearOptimizerParams.h.

◆ verbosity

Verbosity gtsam::NonlinearOptimizerParams::verbosity = SILENT

The printing verbosity during optimization (default SILENT)

Definition at line 46 of file NonlinearOptimizerParams.h.


The documentation for this class was generated from the following files:


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:05