40 OptimizationAlgorithmLevenberg::OptimizationAlgorithmLevenberg(
Solver* solver) :
62 if (iteration == 0 && !online) {
66 return OptimizationAlgorithm::Fail;
79 double tempChi=currentChi;
120 tempChi=std::numeric_limits<double>::max();
122 rho = (currentChi-tempChi);
128 double alpha = 1.-pow((2*rho-1),3);
153 double maxDiagonal=0.;
158 for (
int j = 0; j < dim; ++j){
159 maxDiagonal = std::max(fabs(v->
hessian(j,j)),maxDiagonal);
162 return _tau*maxDiagonal;
double computeLambdaInit() const
double get_monotonic_time()
virtual void restoreDiagonal()=0
virtual bool schur()=0
should the solver perform the schur complement or not
statistics about the optimization
Property< double > * _userLambdaInit
bool terminate()
if external stop flag is given, return its state. False otherwise
#define __PRETTY_FUNCTION__
double computeScale() const
double _goodStepLowerScale
lower bound for lambda decrease if a good LM step
virtual const double & hessian(int i, int j) const =0
get the element from the hessian matrix
double _goodStepUpperScale
upper bound for lambda decrease if a good LM step
double timeResiduals
residuals
int _levenbergIterations
the numer of levenberg iterations performed to accept the last step
virtual void printVerbose(std::ostream &os) const
void pop(SparseOptimizer::VertexContainer &vlist)
pop (restore) the estimate a subset of the variables from the stack
virtual bool setLambda(double lambda, bool backup=false)=0
int levenbergIterations
number of iterations performed by LM
void computeActiveErrors()
void discardTop(SparseOptimizer::VertexContainer &vlist)
ignore the latest stored element on the stack, remove it from the stack but do not restore the estima...
Base for solvers operating on the approximated Hessian, e.g., Gauss-Newton, Levenberg.
virtual ~OptimizationAlgorithmLevenberg()
utility functions for handling time related stuff
PropertyMap _properties
the properties of your solver, use this to store the parameters of your solver
int dimension() const
dimension of the estimated state belonging to this node
P * makeProperty(const std::string &name_, const typename P::ValueType &v)
void setValue(const T &v)
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
SparseOptimizer * _optimizer
the optimizer the solver is working on
static G2OBatchStatistics * globalStats()
const VertexContainer & indexMapping() const
the index mapping of the vertices
SparseOptimizer * optimizer() const
the optimizer (graph) on which the solver works
A general case Vertex for optimization.
Property< int > * _maxTrialsAfterFailure
double * x()
return x, the solution vector
void setUserLambdaInit(double lambda)
specify the initial lambda used for the first iteraion, if not given the SparseOptimizer tries to com...
double timeUpdate
time to apply the update
double * b()
return b, the right hand side of the system
virtual bool buildSystem()=0
size_t vectorSize() const
return the size of the solution vector (x) and b
double activeRobustChi2() const
double timeQuadraticForm
construct the quadratic form in the graph
void setMaxTrialsAfterFailure(int max_trials)
the number of internal iteration if an update step increases chi^2 within Levenberg-Marquardt ...
void push(SparseOptimizer::VertexContainer &vlist)
push the estimate of a subset of the variables onto a stack
double timeLinearSolution
total time for solving Ax=b (including detup for schur)
virtual SolverResult solve(int iteration, bool online=false)
virtual bool buildStructure(bool zeroBlocks=false)=0