ImFusion SDK 4.3
OptimizerWrapper Class Reference

#include <ImFusion/Base/OptimizerWrapper.h>

Wrapper around Optimizer and CostFunction classes to work on simple lambda functions. More...

+ Inheritance diagram for OptimizerWrapper:

Detailed Description

Wrapper around Optimizer and CostFunction classes to work on simple lambda functions.

Example usage:

auto costFunction = [&](int n, const double* x) { return ...; };
OptimizerWrapper ow(costFunction, 3);
ow.compute();
Wrapper around Optimizer and CostFunction classes to work on simple lambda functions.
Definition OptimizerWrapper.h:21

Public Member Functions

 OptimizerWrapper (std::function< double(int, const double *)> cf, int dim, int type=34)
 Constructor with lambda cost function, dimension and optional NLopt type (BOBYQA by default)
 
OptimizerNLopt ()
 Provides access to the underlying OptimizerNL instance for all detailed settings.
 
int compute (std::vector< double > &pars)
 Executes the optimization with the given initial parameters.
 
int compute ()
 Executes the optimization with zero-initialized parameters.
 
double evaluate (int n, const double *x, double *dx=0) override
 Forwards the cost function evaluation to the lambda function (derivatives not supported)
 

Protected Attributes

std::function< double(int, const double *)> m_cf
 Cost function.
 
OptimizerNL m_opt
 Optimizer instance.
 

Member Function Documentation

◆ evaluate()

double evaluate ( int n,
const double * x,
double * dx = 0 )
inlineoverridevirtual

Forwards the cost function evaluation to the lambda function (derivatives not supported)

Implements CostFunction.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close