bazar
1.3.1
|
#include <ls_minimizer2.h>
Classes | |
struct | observation |
struct | observation_nn |
Pre-defined structure for users that prefer function pointers to class heritage. More... |
Public Types | |
enum | { MAX_B_SIZE = 4 } |
typedef double | flt_t |
typedef void(* | callback_function )(flt_t *state, void **user_data) |
typedef void(* | func_nn_ptr )(const flt_t *state, const flt_t *data, int data_size, flt_t *b, flt_t *J, void **user_data) |
Function pointer type used by observation_nn. | |
typedef bool(* | sample_consensus_func )(flt_t *computed_state, observation **obs, int nobs, void **user_data) |
Public Member Functions | |
ls_minimizer2 (int state_size=0) | |
~ls_minimizer2 () | |
void | set_state_size (int size) |
Defines the optimization space dimentionality, i.e. the number of optimized parameters. | |
void | set_scales (flt_t *scales) |
void | desactivate_automated_scaling (void) |
void | set_verbose_level (int vl) |
void | set_user_data (int slot_index, void *ptr) |
void | reset_observations (void) |
call that before adding observations for a new optimization. | |
void | erase_observations (int a, int b=-1) |
Remove some observations. a=0, b=-1 is equivalent to reset_observation. | |
void | add_observation (observation *obs, bool to_delete, bool to_array_delete) |
void | add_observation_2data_1measure (func_nn_ptr f, const flt_t data[2], const flt_t goal) |
void | add_observation_3data_1measure (func_nn_ptr f, const flt_t data[3], const flt_t goal) |
void | add_observation_2data_2measures (func_nn_ptr f, const flt_t data[2], const flt_t goal[2]) |
void | add_observation_3data_2measures (func_nn_ptr f, const flt_t data[3], const flt_t goal[2]) |
void | set_new_iteration_callback (callback_function callback) |
this callback is called at the end of every iteration | |
void | set_state_change_callback (callback_function callback) |
this callback is called each time the state vector changes. | |
void | set_default_c (flt_t c) |
void | set_last_observation_c (flt_t c) |
void | set_last_observation_c_max_c_min (flt_t c_max, flt_t c_min) |
For robust estimation using Julien' method (default = +inf for both): | |
void | set_last_observation_weight (flt_t weight) |
Set observation weight (default = 1): | |
void | set_last_observation_confidence (flt_t confidence) |
Set observation confidence (default = 1). Only used for PROSAC and cat tail. | |
int | minimize_using_steepest_descent_from (flt_t *initial_state) |
int | minimize_using_levenberg_marquardt_from (flt_t *initial_state) |
Levenberg-Marquardt minimization. | |
void | lm_set_max_iterations (int it) |
void | lm_set_max_failures_in_a_row (int f) |
if f iterations do not decrease the function, stop. | |
void | lm_set_tol_cos (flt_t t) |
stop condition. Very restrictive: 0.999 less restrictive: 0.9 | |
void | lm_set_initial_lambda (flt_t l) |
bool | minimize_using_gauss_newton_from (flt_t *initial_state) |
int | minimize_using_dogleg_from (flt_t *initial_state) |
Dogleg (not convincing). | |
int | minimize_using_cattail_from (flt_t *initial_state) |
void | ct_set_max_iterations (int it) |
void | set_line_search_parameters (flt_t lambda0, flt_t k_rough, flt_t k_fine) |
flt_t | minimize_using_prosac (sample_consensus_func f, int nb_samples, int min_number_of_inliers, int max_number_of_iterations) |
flt_t | minimize_using_julien_method_from (const flt_t *state, int nb_steps, int nb_iterations_per_step) |
void | check_jacobians_around (flt_t *state, flt_t state_step) |
void | set_last_observation_as_outlier (void) |
void | set_ground_truth (flt_t *state) |
void | compare_outliers_with_ground_truth (void) |
void | compare_state_with_ground_truth (void) |
void | reserve (int max_obs) |
int | count_measures () |
Public Attributes | |
flt_t * | state |
state vector | |
bool | use_user_scaling |
bool | use_automated_scaling |
int | lm_max_iterations |
int | lm_max_failures_in_a_row |
flt_t | lm_initial_lambda |
flt_t | lm_tol_cos |
int | verbose_level |
Non-linear Minimizer, modified API
Definition at line 39 of file ls_minimizer2.h.
Definition at line 44 of file ls_minimizer2.h.
typedef double ls_minimizer2::flt_t |
Definition at line 43 of file ls_minimizer2.h.
typedef void(* ls_minimizer2::func_nn_ptr)(const flt_t *state, const flt_t *data, int data_size, flt_t *b, flt_t *J, void **user_data) |
Function pointer type used by observation_nn.
Definition at line 83 of file ls_minimizer2.h.
typedef bool(* ls_minimizer2::sample_consensus_func)(flt_t *computed_state, observation **obs, int nobs, void **user_data) |
Definition at line 206 of file ls_minimizer2.h.
anonymous enum |
Definition at line 49 of file ls_minimizer2.h.
ls_minimizer2::ls_minimizer2 | ( | int | state_size = 0 | ) |
Definition at line 33 of file ls_minimizer2.cpp.
ls_minimizer2::~ls_minimizer2 | ( | ) |
Definition at line 104 of file ls_minimizer2.cpp.
void ls_minimizer2::add_observation | ( | observation * | obs, |
bool | to_delete, | ||
bool | to_array_delete | ||
) |
Definition at line 262 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::array_delete_me, ls_minimizer2::observation::delete_me, ls_minimizer2::observation::sqrt_weight, and ls_minimizer2::observation::weight.
void ls_minimizer2::add_observation_2data_1measure | ( | func_nn_ptr | f, |
const flt_t | data[2], | ||
const flt_t | goal | ||
) |
Definition at line 1132 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::set_default_values().
void ls_minimizer2::add_observation_2data_2measures | ( | func_nn_ptr | f, |
const flt_t | data[2], | ||
const flt_t | goal[2] | ||
) |
Definition at line 1146 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::set_default_values().
void ls_minimizer2::add_observation_3data_1measure | ( | func_nn_ptr | f, |
const flt_t | data[3], | ||
const flt_t | goal | ||
) |
Definition at line 1139 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::set_default_values().
void ls_minimizer2::add_observation_3data_2measures | ( | func_nn_ptr | f, |
const flt_t | data[3], | ||
const flt_t | goal[2] | ||
) |
Definition at line 1153 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::set_default_values().
Checking derivatives: compares finite difference jacobian and analytical jacobian computed by the user provided functions.
Definition at line 1091 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::eval_func(), and ls_minimizer2::observation::get_nb_measures().
void ls_minimizer2::compare_outliers_with_ground_truth | ( | void | ) |
Definition at line 351 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::eval_func(), ls_minimizer2::observation::ground_truth_outlier, ls_minimizer2::observation::residual(), and ls_minimizer2::observation::squared_c.
void ls_minimizer2::compare_state_with_ground_truth | ( | void | ) |
Definition at line 339 of file ls_minimizer2.cpp.
int ls_minimizer2::count_measures | ( | ) |
Definition at line 557 of file ls_minimizer2.cpp.
References msg.
|
inline |
Definition at line 202 of file ls_minimizer2.h.
|
inline |
Definition at line 122 of file ls_minimizer2.h.
References use_automated_scaling.
void ls_minimizer2::erase_observations | ( | int | a, |
int | b = -1 |
||
) |
Remove some observations. a=0, b=-1 is equivalent to reset_observation.
Definition at line 242 of file ls_minimizer2.cpp.
void ls_minimizer2::lm_set_initial_lambda | ( | flt_t | l | ) |
Definition at line 206 of file ls_minimizer2.cpp.
void ls_minimizer2::lm_set_max_failures_in_a_row | ( | int | f | ) |
if f iterations do not decrease the function, stop.
Definition at line 196 of file ls_minimizer2.cpp.
void ls_minimizer2::lm_set_max_iterations | ( | int | it | ) |
Definition at line 191 of file ls_minimizer2.cpp.
void ls_minimizer2::lm_set_tol_cos | ( | flt_t | t | ) |
stop condition. Very restrictive: 0.999 less restrictive: 0.9
Definition at line 201 of file ls_minimizer2.cpp.
int ls_minimizer2::minimize_using_cattail_from | ( | flt_t * | initial_state | ) |
Cat Tail (experimental) a mix between gauss-newton and line search.
Definition at line 898 of file ls_minimizer2.cpp.
References confidence_cmp(), and msg.
int ls_minimizer2::minimize_using_dogleg_from | ( | flt_t * | initial_state | ) |
Dogleg (not convincing).
TODO looks wrong..
Definition at line 718 of file ls_minimizer2.cpp.
References msg, and solve_deg2().
bool ls_minimizer2::minimize_using_gauss_newton_from | ( | flt_t * | initial_state | ) |
ls_minimizer2::flt_t ls_minimizer2::minimize_using_julien_method_from | ( | const flt_t * | state, |
int | nb_steps, | ||
int | nb_iterations_per_step | ||
) |
Definition at line 1065 of file ls_minimizer2.cpp.
References msg.
int ls_minimizer2::minimize_using_levenberg_marquardt_from | ( | flt_t * | initial_state | ) |
Levenberg-Marquardt minimization.
Julien new_state actually contains the old state
Definition at line 579 of file ls_minimizer2.cpp.
References msg.
ls_minimizer2::flt_t ls_minimizer2::minimize_using_prosac | ( | sample_consensus_func | f, |
int | nb_samples, | ||
int | min_number_of_inliers, | ||
int | max_number_of_iterations | ||
) |
TODO <Julien> I modified this. It may be wrong.
Definition at line 1008 of file ls_minimizer2.cpp.
References confidence_cmp(), and mymin().
int ls_minimizer2::minimize_using_steepest_descent_from | ( | flt_t * | initial_state | ) |
|
inline |
Definition at line 224 of file ls_minimizer2.h.
void ls_minimizer2::reset_observations | ( | void | ) |
call that before adding observations for a new optimization.
Definition at line 238 of file ls_minimizer2.cpp.
void ls_minimizer2::set_default_c | ( | flt_t | c | ) |
For robust estimation (default = +inf) residual = max( ||b-f(d,state)||^2, c^2 ) This value will be applied to next added observations
Definition at line 257 of file ls_minimizer2.cpp.
void ls_minimizer2::set_ground_truth | ( | flt_t * | state | ) |
Definition at line 219 of file ls_minimizer2.cpp.
void ls_minimizer2::set_last_observation_as_outlier | ( | void | ) |
Definition at line 305 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::outlier.
void ls_minimizer2::set_last_observation_c | ( | flt_t | c | ) |
For robust estimation (default = +inf): change the last added observation robust estimator value
Definition at line 274 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::squared_c.
For robust estimation using Julien' method (default = +inf for both):
Definition at line 282 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::c_max, and ls_minimizer2::observation::c_min.
void ls_minimizer2::set_last_observation_confidence | ( | flt_t | confidence | ) |
Set observation confidence (default = 1). Only used for PROSAC and cat tail.
Definition at line 298 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::confidence.
void ls_minimizer2::set_last_observation_weight | ( | flt_t | weight | ) |
Set observation weight (default = 1):
Definition at line 290 of file ls_minimizer2.cpp.
References ls_minimizer2::observation::sqrt_weight, and ls_minimizer2::observation::weight.
Definition at line 211 of file ls_minimizer2.cpp.
void ls_minimizer2::set_new_iteration_callback | ( | callback_function | callback | ) |
this callback is called at the end of every iteration
Definition at line 228 of file ls_minimizer2.cpp.
void ls_minimizer2::set_scales | ( | flt_t * | scales | ) |
Scale applied to each optimized parameter (each dimension of the optimization space). Not used by default, but an automated method is used.
Definition at line 156 of file ls_minimizer2.cpp.
void ls_minimizer2::set_state_change_callback | ( | callback_function | callback | ) |
this callback is called each time the state vector changes.
Definition at line 233 of file ls_minimizer2.cpp.
void ls_minimizer2::set_state_size | ( | int | size | ) |
Defines the optimization space dimentionality, i.e. the number of optimized parameters.
Definition at line 50 of file ls_minimizer2.cpp.
void ls_minimizer2::set_user_data | ( | int | slot_index, |
void * | ptr | ||
) |
user arbitrary pointers. slot_index should be in [0,9] this pointer array is passed to the callback functions
Definition at line 149 of file ls_minimizer2.cpp.
void ls_minimizer2::set_verbose_level | ( | int | vl | ) |
0 = nothing 1 = messages before and after minimization 2 = message at each iteration. 3 = debug
Definition at line 186 of file ls_minimizer2.cpp.
flt_t ls_minimizer2::lm_initial_lambda |
Definition at line 284 of file ls_minimizer2.h.
int ls_minimizer2::lm_max_failures_in_a_row |
Definition at line 283 of file ls_minimizer2.h.
int ls_minimizer2::lm_max_iterations |
Definition at line 282 of file ls_minimizer2.h.
flt_t ls_minimizer2::lm_tol_cos |
Definition at line 285 of file ls_minimizer2.h.
flt_t* ls_minimizer2::state |
state vector
Definition at line 176 of file ls_minimizer2.h.
bool ls_minimizer2::use_automated_scaling |
Definition at line 274 of file ls_minimizer2.h.
Referenced by desactivate_automated_scaling().
bool ls_minimizer2::use_user_scaling |
Definition at line 274 of file ls_minimizer2.h.
int ls_minimizer2::verbose_level |
Definition at line 308 of file ls_minimizer2.h.