40 #ifndef GEOGRAM_NUMERICS_OPTIMIZER
41 #define GEOGRAM_NUMERICS_OPTIMIZER
84 typedef void (* funcgrad_callback)(
85 index_t N,
double* x,
double& f,
double* g
92 typedef void (* newiteration_callback)(
93 index_t N,
const double* x,
double f,
const double* g,
double gnorm
101 typedef void (* evalhessian_callback)(
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;
253 funcgrad_callback funcgrad_callback_;
254 newiteration_callback newiteration_callback_;
255 evalhessian_callback evalhessian_callback_;
284 #define geo_register_Optimizer_creator(type, name) \
285 geo_register_creator(GEO::OptimizerFactory, type, name)
Assertion checking mechanism.
Base class for reference-counted objects.
Factory for types without constructor arguments.
Optimizer minimizes a multivariate function.
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.
static Optimizer * create(const std::string &name="default")
Creates an Optimizer.
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 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.
virtual void optimize(double *x)=0
Minimizes a function, starting from initial value x.
void set_epsf(double ef)
Defines the stopping criterion in terms of function value.
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.
Common include file, providing basic definitions. Should be included before anything else by all head...
Generic factory mechanism.
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.