driver that optimizes an Objective using a chosen Algorithm. More...
#include <cl_Optimizer.hpp>
Public Member Functions | |
| Optimizer (Objective &aObjective, const Algorithm aAlgorithm) | |
| ~Optimizer ()=default | |
| void | set_bounds (const Vector< real > &aLowerBounds, const Vector< real > &aUpperBounds) |
| set the lower and upper bounds of the design variables. | |
| Status | optimize (Vector< real > &aX, real &aValue) |
| run the optimization, starting from and writing back into aX. | |
| const string & | errmsg () const |
| detailed diagnostic from the solver for the most recent optimize() call ( e.g. | |
| real & | ftol_rel () |
| relative tolerance on the objective value ( ftol_rel ) | |
| real & | xtol_rel () |
| relative tolerance on the design vector ( xtol_rel ) | |
| uint & | max_eval () |
| maximum number of objective evaluations; 0 means unlimited | |
| bool & | maximize () |
| flag selecting maximization ( true ) over minimization ( false ) | |
| const Algorithm & | algorithm () const |
| the algorithm used by this optimizer | |
driver that optimizes an Objective using a chosen Algorithm.
This is the counterpart of ode::Integrator: it owns the numerical bookkeeping (bounds, tolerances, evaluation budget) while remaining agnostic of what is being optimized. The concrete solver library (nlopt) is a private implementation detail of cl_Optimizer.cpp.
The Objective is borrowed by reference (non-owning) and must outlive every call to optimize(), just as ode::Integrator borrows its ODE.
|
default |
|
inline |
the algorithm used by this optimizer
|
inline |
detailed diagnostic from the solver for the most recent optimize() call ( e.g.
which bound fails lb <= ub ); empty when no detail was reported. Complements the generic error_message( status ).
|
inline |
relative tolerance on the objective value ( ftol_rel )
|
inline |
maximum number of objective evaluations; 0 means unlimited
|
inline |
flag selecting maximization ( true ) over minimization ( false )
run the optimization, starting from and writing back into aX.
| aX | on entry the initial guess, on exit the optimum |
| aValue | on exit the objective value at aX |
aX and aValue are only meaningful when is_usable( status ) is true; on failure they must not be trusted. When the solver reports a detailed diagnostic, it is available via errmsg().
| void belfem::opt::Optimizer::set_bounds | ( | const Vector< real > & | aLowerBounds, |
| const Vector< real > & | aUpperBounds ) |
set the lower and upper bounds of the design variables.
Each vector must have length objective.dimension().
Setting aLowerBounds( i ) == aUpperBounds( i ) fixes design variable i: nlopt eliminates that dimension internally, so parameters can be pinned without changing the Objective.
|
inline |
relative tolerance on the design vector ( xtol_rel )