40#ifndef GEOGRAM_NUMERICS_OPTIMIZER
41#define GEOGRAM_NUMERICS_OPTIMIZER
85 index_t N,
double* x,
double& f,
double* g
93 index_t N,
const double* x,
double f,
const double* g,
double gnorm
102 index_t N,
double* x,
double& f,
double* g, HESSIAN_MATRIX& hessian
177 funcgrad_callback_ = fp;
185 newiteration_callback_ = fp;
196 evalhessian_callback_ = fp;
284#define geo_register_Optimizer_creator(type, name) \
285 geo_register_creator(GEO::OptimizerFactory, type, name)
Assertion checking mechanism.
Counted()
Creates a reference counted object.
Factory for types without constructor arguments.
void set_max_iter(index_t maxiter)
Defines the maximum number of iterations.
~Optimizer() override
Optimizer destructor.
void set_M(index_t M)
Defines the inner number of iterations.
void set_epsg(double eg)
Defines the stopping criterion in terms of gradient magnitude.
index_t get_N() const
Returns the number of variables.
Optimizer()
Optimizer constructor.
void set_evalhessian_callback(evalhessian_callback fp)
Defines the callback that evaluates the Hessian of function to be minimized (second order derivatives...
index_t get_max_iter() const
Returns the maximum number of iterations.
Factory0< Optimizer > OptimizerFactory
Optimizer Factory.
void set_epsx(double ex)
Defines the stopping criterion in terms of variation of x.
SmartPointer< Optimizer > Optimizer_var
Smart pointer that contains an Optimizer object.
void(* funcgrad_callback)(index_t N, double *x, double &f, double *g)
Optimizer callback that evaluates a function and its gradient.
void set_verbose(bool verb)
Enables or disables verbose logs.
index_t get_M() const
Returns the inner number of iterations.
void set_funcgrad_callback(funcgrad_callback fp)
Defines the callback that evaluates the function to be minimized and its gradient.
void(* newiteration_callback)(index_t N, const double *x, double f, const double *g, double gnorm)
Optimizer callback that is called at each iteration.
virtual void optimize(double *x)=0
Minimizes a function, starting from initial value x.
void(* evalhessian_callback)(index_t N, double *x, double &f, double *g, HESSIAN_MATRIX &hessian)
Optimizer callback that evaluates a function, its gradient and its Hessian.
void set_epsf(double ef)
Defines the stopping criterion in terms of function value.
static Optimizer * create(const std::string &name="default")
Creates an Optimizer.
void set_N(index_t N)
Defines the number of variables.
void set_newiteration_callback(newiteration_callback fp)
Defines a callback that will be called at each iteration.
A smart pointer with reference-counted copy semantics.
Base class of reference-counted objects, to be used with smart pointers.
Generic factory mechanism.
Common include file, providing basic definitions. Should be included before anything else by all head...
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Types and functions for numbers manipulation.
Pointers with automatic reference counting.