42 std::unique_ptr<Solver>
solver)
60 int iteration,
bool online) {
63 "underlying linear solver operates on different graph");
67 bool ok =
_solver.buildStructure();
70 return OptimizationAlgorithm::Fail;
82 double currentChi =
_optimizer->activeRobustChi2();
120 double tempChi =
_optimizer->activeRobustChi2();
122 if (!ok2) tempChi = std::numeric_limits<double>::max();
124 rho = (currentChi - tempChi);
130 double alpha = 1. - pow((2 * rho - 1), 3);
136 currentChi = tempChi;
145 }
while (rho < 0 && qmax < _maxTrialsAfterFailure->value() &&
156 double maxDiagonal = 0;
157 for (
size_t k = 0; k <
_optimizer->indexMapping().size(); k++) {
161 for (
int j = 0; j < dim; ++j) {
162 maxDiagonal = std::max(fabs(v->
hessian(j, j)), maxDiagonal);
165 return _tau * maxDiagonal;
170 for (
size_t j = 0; j <
_solver.vectorSize(); j++) {
186 os <<
"\t schur= " <<
_solver.schur()
A general case Vertex for optimization.
virtual const double & hessian(int i, int j) const =0
get the element from the hessian matrix
int dimension() const
dimension of the estimated state belonging to this node
Property< double > * _userLambdaInit
void setMaxTrialsAfterFailure(int max_trials)
double _goodStepUpperScale
Property< int > * _maxTrialsAfterFailure
double computeLambdaInit() const
std::unique_ptr< Solver > m_solver
OptimizationAlgorithmLevenberg(std::unique_ptr< Solver > solver)
double _goodStepLowerScale
virtual void printVerbose(std::ostream &os) const
virtual SolverResult solve(int iteration, bool online=false)
virtual ~OptimizationAlgorithmLevenberg()
void setUserLambdaInit(double lambda)
double computeScale() const
Solver & solver()
return the underlying solver used to solve the linear system
OptimizationAlgorithmWithHessian(Solver &solver)
SparseOptimizer * _optimizer
the optimizer the solver is working on
#define __PRETTY_FUNCTION__
constexpr double cst(long double v)
double get_monotonic_time()
statistics about the optimization
double timeLinearSolution
double timeResiduals
residuals
static G2OBatchStatistics * globalStats()
double timeUpdate
time to apply the update
int levenbergIterations
number of iterations performed by LM
double timeQuadraticForm
construct the quadratic form in the graph
utility functions for handling time related stuff