2 #ifndef vnl_nonlinear_minimizer_h_ 3 #define vnl_nonlinear_minimizer_h_ 18 # include <vcl_msvc_warnings.h> 21 #include "vnl/vnl_export.h" 54 epsfcn = xtol * 0.001;
104 ERROR_DODGY_INPUT = 0,
109 FAILED_TOO_MANY_ITERATIONS = 5,
110 TOO_MANY_ITERATIONS = FAILED_TOO_MANY_ITERATIONS,
111 FAILED_FTOL_TOO_SMALL = 6,
112 FAILED_XTOL_TOO_SMALL = 7,
113 FAILED_GTOL_TOO_SMALL = 8,
114 FAILED_USER_REQUEST = 9
118 bool obj_value_reduced() {
return failure_code_ != ERROR_FAILURE && failure_code_ != ERROR_DODGY_INPUT && end_error_ < start_error_; }
125 virtual std::string is_a()
const;
129 virtual bool is_class(std::string
const& s)
const;
159 void report_eval(
double f);
164 virtual bool report_iter();
167 #endif // vnl_nonlinear_minimizer_h_ void set_f_tolerance(double v)
Set the convergence tolerance on F (sum of squared residuals).
double get_x_tolerance() const
void set_check_derivatives(int cd)
Set check_derivatives flag. Negative values may mean fewer checks.
int get_check_derivatives() const
An ordinary mathematical matrix.
int get_num_iterations() const
Return the number of {iterations} in the last minimization.
ReturnCodes get_failure_code() const
Return the failure code of the last minimization.
double get_g_tolerance() const
bool obj_value_reduced()
Whether the error reduced in the last minimization.
double get_epsilon_function() const
double get_end_error() const
Return the best error that was achieved by the last minimization, corresponding to the returned x.
int get_num_evaluations() const
Return the total number of times the function was evaluated by the last minimization.
void set_verbose(bool verb)
Set verbose flag.
vnl_nonlinear_minimizer is a base class for nonlinear optimization.
double epsfcn
Step length for FD Jacobian.
double ftol
Termination tolerance on F (sum of squared residuals)
void set_g_tolerance(double v)
Set the convergence tolerance on Grad(F)' * F.
double gtol
Termination tolerance on Grad(F)' * F = 0.
double get_f_tolerance() const
void set_max_function_evals(int v)
Set the termination maximum number of iterations.
ReturnCodes
Some generic return codes that apply to all minimizers.
void set_epsilon_function(double v)
Set the step length for FD Jacobian.
double xtol
Termination tolerance on X (solution vector)
int get_max_function_evals() const
double get_start_error() const
Return the error of the function when it was evaluated at the start point of the last minimization.
long maxfev
Termination maximum number of iterations.
ReturnCodes failure_code_
void set_x_tolerance(double v)
Set the convergence tolerance on X.
void set_trace(bool on)
Turn on per-iteration printouts.