Loading...
Searching...
No Matches
NonlinearOptimizer.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
#include <gtsam/nonlinear/NonlinearOptimizerParams.h>
namespace gtsam {
namespace internal { struct NonlinearOptimizerState; }
class GTSAM_EXPORT NonlinearOptimizer {
protected:
NonlinearFactorGraph graph_;
std::unique_ptr<internal::NonlinearOptimizerState> state_;
public:
using shared_ptr = boost::shared_ptr<const NonlinearOptimizer>;
virtual const Values& optimize() { defaultOptimize(); return values(); }
const Values& optimizeSafely();
double error() const;
size_t iterations() const;
const Values &values() const;
const NonlinearFactorGraph &graph() const { return graph_; }
virtual ~NonlinearOptimizer();
virtual VectorValues solve(const GaussianFactorGraph &gfg,
const NonlinearOptimizerParams& params) const;
virtual GaussianFactorGraph::shared_ptr iterate() = 0;
protected:
void defaultOptimize();
virtual const NonlinearOptimizerParams& _params() const = 0;
NonlinearOptimizer(const NonlinearFactorGraph& graph,
std::unique_ptr<internal::NonlinearOptimizerState> state);
};
GTSAM_EXPORT bool checkConvergence(double relativeErrorTreshold,
double absoluteErrorTreshold, double errorThreshold,
double currentError, double newError, NonlinearOptimizerParams::Verbosity verbosity = NonlinearOptimizerParams::SILENT);
GTSAM_EXPORT bool checkConvergence(const NonlinearOptimizerParams& params, double currentError,
double newError);
} // gtsam
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
NonlinearOptimizerParams.h
Parameters for nonlinear optimization.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::checkConvergence
bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold, double errorThreshold, double currentError, double newError, NonlinearOptimizerParams::Verbosity verbosity)
Check whether the relative error decrease is less than relativeErrorTreshold, the absolute error decr...
Definition NonlinearOptimizer.cpp:185
gtsam::GaussianFactorGraph
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:75
gtsam::GaussianFactorGraph::shared_ptr
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition GaussianFactorGraph.h:81
gtsam::VectorValues
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:74
gtsam::NonlinearFactorGraph
Definition NonlinearFactorGraph.h:55
gtsam::NonlinearOptimizer
This is the abstract interface for classes that can optimize for the maximum-likelihood estimate of a...
Definition NonlinearOptimizer.h:75
gtsam::NonlinearOptimizer::graph
const NonlinearFactorGraph & graph() const
return the graph with nonlinear factors
Definition NonlinearOptimizer.h:118
gtsam::NonlinearOptimizer::graph_
NonlinearFactorGraph graph_
The graph with nonlinear factors.
Definition NonlinearOptimizer.h:78
gtsam::NonlinearOptimizer::optimize
virtual const Values & optimize()
Optimize for the maximum-likelihood estimate, returning a the optimized variable assignments.
Definition NonlinearOptimizer.h:98
gtsam::NonlinearOptimizer::state_
std::unique_ptr< internal::NonlinearOptimizerState > state_
PIMPL'd state.
Definition NonlinearOptimizer.h:80
gtsam::NonlinearOptimizer::shared_ptr
boost::shared_ptr< const NonlinearOptimizer > shared_ptr
A shared pointer to this class.
Definition NonlinearOptimizer.h:84
gtsam::NonlinearOptimizer::iterate
virtual GaussianFactorGraph::shared_ptr iterate()=0
Perform a single iteration, returning GaussianFactorGraph corresponding to the linearized factor grap...
gtsam::NonlinearOptimizer::NonlinearOptimizer
NonlinearOptimizer(const NonlinearFactorGraph &graph, std::unique_ptr< internal::NonlinearOptimizerState > state)
Constructor for initial construction of base classes.
Definition NonlinearOptimizer.cpp:44
gtsam::NonlinearOptimizer::values
const Values & values() const
return values in current optimizer state
Definition NonlinearOptimizer.cpp:60
gtsam::NonlinearOptimizer::defaultOptimize
void defaultOptimize()
A default implementation of the optimization loop, which calls iterate() until checkConvergence retur...
Definition NonlinearOptimizer.cpp:65
gtsam::NonlinearOptimizerParams
The common parameters for Nonlinear optimizers.
Definition NonlinearOptimizerParams.h:34
gtsam::NonlinearOptimizerParams::Verbosity
Verbosity
See NonlinearOptimizerParams::verbosity.
Definition NonlinearOptimizerParams.h:37
gtsam::Values
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65