Chrono::Engine C++ API
Public Member Functions | Public Attributes | Protected Attributes
chrono::ChOptimizer Class Reference

#include <ChSolvmin.h>

Inheritance diagram for chrono::ChOptimizer:
Inheritance graph
[legend]
Collaboration diagram for chrono::ChOptimizer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChOptimizer ()
virtual void Copy (ChOptimizer *source)
virtual void SetObjective (ChFx *mformula)
virtual ChFxGetObjective ()
virtual void SetObjectiveGrad (ChFx *mformula)
virtual ChFxGetObjectiveGrad ()
virtual void SetNumOfVars (int mv)
virtual int GetNumOfVars ()
double * GetXv ()
double * GetXv_sup ()
double * GetXv_inf ()
void SetXv (double *mx)
void SetXv_sup (double *mx)
void SetXv_inf (double *mx)
double Eval_fx (double x[])
double Eval_fx (const ChMatrix<> *x)
void Eval_grad (double x[], double gr[])
void Eval_grad (const ChMatrix<> *x, ChMatrix<> *gr)
virtual int PreOptimize ()
virtual int DoOptimize ()
virtual int PostOptimize ()
virtual int Optimize ()
void DoBreakCheck ()

Public Attributes

bool minimize
double grad_step
double opt_fx
char err_message [200]
int error_code
long fx_evaluations
long grad_evaluations
int(* break_funct )()
int break_cycles
int user_break
int break_cyclecounter

Protected Attributes

ChFxafunction
ChFxafunctionGrad
int C_vars
double * xv
double * xv_sup
double * xv_inf

Detailed Description

Base class for multi-variable optimization.


Constructor & Destructor Documentation

chrono::ChOptimizer::ChOptimizer ( )

Ch_optimizer Base optimization engine member functions


Member Function Documentation

void chrono::ChOptimizer::DoBreakCheck ( )

Each break_cycles number of times this fx is called, the function break_funct() is evaluated (if any) and if positive, the variable user_break becomes true.

double chrono::ChOptimizer::Eval_fx ( double  x[])

Returns the value of the functional, for given state of variables and with the given "database" multibody system. Here evaluates the string "function".

void chrono::ChOptimizer::Eval_grad ( double  x[],
double  gr[] 
)

Computes the gradient of objective function, for given state of variables. The gradient is stored into gr vector.

int chrono::ChOptimizer::Optimize ( ) [virtual]

Does the three steps in sequence PreOptimize, DoOptimize, PostOptimize. The derived classes shouldn't need the definition of this method, because they just have to implement the DoOptimize.

int chrono::ChOptimizer::PreOptimize ( ) [virtual]

Performs the optimization of the ChSystem pointed by "database" (or whatever object which can evaluate the string "function" and the "optvarlist") using the current parameters. Returns false if some error occured.

virtual void chrono::ChOptimizer::SetNumOfVars ( int  mv) [virtual]

Set the number of optimization variables. Note: this must be set properly as the number of variables used in the objective function!

Reimplemented in chrono::ChOptimizerHybrid.

virtual void chrono::ChOptimizer::SetObjectiveGrad ( ChFx mformula) [virtual]

Sets the objective function gradient (not mandatory, because if not set, the default bacward differentiation is used).

Reimplemented in chrono::ChOptimizerHybrid.