9#include <tinyopt/log.h>
10#include <tinyopt/math.h>
24 LevenbergMarquardt = 0,
41 Options(Solver type = Solver::LevenbergMarquardt) :
solver_type(type) {};
102 std::function<bool(
double,
double,
double)> stop_callback;
103 std::function<bool(
float,
const VecXf &,
const VecXf &)> stop_callback2;
117 std::string
e =
"ε²";
126 bool print_failure =
false;
139 std::array<float, 2> damping_range{{1e-9f, 1e9f}};
160 float step_size = 0.25f;
161 float step_reduction = 0.5f;
165 float radius_init = 1.0f;
166 float radius_max = 1e6f;
167 float shrink_factor = 0.25f;
168 float expand_factor = 2.0f;
172 float step_size = 1.0f;
173 float step_reduction = 0.5f;
174 float step_growth = 1.5f;
175 float max_step_size = 1.0f;
176 float curvature_threshold = 1e-8f;
180 float step_size = 1.0f;
181 float step_reduction = 0.5f;
182 float step_growth = 1.5f;
183 float max_step_size = 1.0f;
184 float curvature_threshold = 1e-8f;
185 uint8_t history_size = 8;
bool normalize
Normalize the final error by the number of residuals (after use_squared_norm).
Definition options.h:83
bool use_squared_norm
Use squared norm instead of norm (faster).
Definition options.h:80
bool downscale_by_2
Definition options.h:81
float lr
Initial learning rate.
Definition options.h:151
bool save_last
Saves the last Hessian H as part of the output results.
Definition options.h:70
bool H_is_full
Specify if H is only Upper triangularly or fully filled.
Definition options.h:65
float check_min_H_diag
threshold. Use 0 to disable the check.
Definition options.h:67
float damping_init
Definition options.h:136
float bad_factor
Scale to apply to the damping for bad steps.
Definition options.h:142
bool jacobi_scaling
Scale normal equations using the clamped Hessian diagonal.
Definition options.h:131
float good_factor
Scale to apply to the damping for good steps.
Definition options.h:141
bool print_dx
Log the value of step 'dx'.
Definition options.h:120
std::string e
Symbol used when logging the error, e.g ε, ε² or √ε etc.
Definition options.h:117
bool enable
Whether to enable the logging.
Definition options.h:116
bool print_t
Log the duration (in ms).
Definition options.h:122
bool print_emoji
Whether to show the emoji or not.
Definition options.h:118
bool print_max_stdev
Definition options.h:124
bool print_x
Log the value of 'x'.
Definition options.h:119
bool print_J_jet
Log the value of 'J' from the Jet.
Definition options.h:123
bool print_inliers
Log the inliers ratio (in %).
Definition options.h:121
bool use_step_quality_approx
Use relative error decrease as step quality; otherwise use 0.0.
Definition options.h:52
float grad_clipping
Gradient clipping to range [-v, +v], disabled if 0.
Definition options.h:55
bool check_final_cost
Recompute the final cost as a rollback safety check.
Definition options.h:49
float min_grad_norm2
Minimum squared gradient norm.
Definition options.h:97
uint16_t max_iters
Maximum number of outer iterations.
Definition options.h:93
std::function< bool(const VecXf &dx, bool is_rollback)> step_callback
Definition options.h:107
uint8_t max_consec_failures
Maximum consecutive failures to decrease error.
Definition options.h:99
double max_duration_ms
Maximum optimization duration in milliseconds.
Definition options.h:100
float min_error
Minimum error/cost.
Definition options.h:94
float min_rerr_dec
Minimum relative error decrease.
Definition options.h:95
uint8_t max_total_failures
Overall max failures to decrease error.
Definition options.h:98
float min_step_norm2
Minimum squared step norm.
Definition options.h:96
double svd_relative_threshold
Relative singular-value cutoff for SVD; 0 uses Eigen's default threshold.
Definition options.h:39
LinearSolverMethod linear_solver
Linear system method. LDLT is enabled by default; methods require their CMake option.
Definition options.h:37
Solver solver_type
Which solver to use. Default is LevenbergMarquardt for NLLS problems.
Definition options.h:33