Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
MathUtils::Rosenbrock Class Reference

Rosenbrock function functor (for testing optimization). f(x,y) = (a - x)^2 + b*(y - x^2)^2 Default: a = 1, b = 100 Global minimum at (a, a^2) = (1, 1) with f = 0. More...

#include <MathUtils_FunctorVector.hxx>

Public Member Functions

 Rosenbrock (double theA=1.0, double theB=100.0)
 Constructor with parameters.
bool Value (const math_Vector &theX, double &theY) const
 Evaluates the Rosenbrock function.
bool Gradient (const math_Vector &theX, math_Vector &theG) const
 Evaluates the gradient of the Rosenbrock function.
bool Values (const math_Vector &theX, double &theY, math_Vector &theG) const
 Evaluates both value and gradient.

Detailed Description

Rosenbrock function functor (for testing optimization). f(x,y) = (a - x)^2 + b*(y - x^2)^2 Default: a = 1, b = 100 Global minimum at (a, a^2) = (1, 1) with f = 0.

Usage:

Rosenbrock aRosen; // Default a=1, b=100
math_Vector aStart(1, 2);
aStart(1) = -1.0; aStart(2) = 1.0;
auto aResult = MathOpt::BFGS(aRosen, aStart);
// Should converge to (1, 1)
Rosenbrock(double theA=1.0, double theB=100.0)
Constructor with parameters.
Definition MathUtils_FunctorVector.hxx:258
math_VectorBase< double > math_Vector
Definition math_Recipes.hxx:25
VectorResult BFGS(Function &theFunc, const math_Vector &theStartingPoint, const Config &theConfig=Config())
BFGS (Broyden-Fletcher-Goldfarb-Shanno) quasi-Newton method. One of the most effective algorithms for...
Definition MathOpt_BFGS.hxx:58

Constructor & Destructor Documentation

◆ Rosenbrock()

MathUtils::Rosenbrock::Rosenbrock ( double theA = 1.0,
double theB = 100.0 )
inline

Constructor with parameters.

Parameters
theAparameter a (default 1.0)
theBparameter b (default 100.0)

Member Function Documentation

◆ Gradient()

bool MathUtils::Rosenbrock::Gradient ( const math_Vector & theX,
math_Vector & theG ) const
inline

Evaluates the gradient of the Rosenbrock function.

Parameters
[in]theXinput vector
[out]theGgradient vector
Returns
true if evaluation succeeded

◆ Value()

bool MathUtils::Rosenbrock::Value ( const math_Vector & theX,
double & theY ) const
inline

Evaluates the Rosenbrock function.

Parameters
[in]theXinput vector (must have length 2)
[out]theYfunction value
Returns
true if evaluation succeeded

◆ Values()

bool MathUtils::Rosenbrock::Values ( const math_Vector & theX,
double & theY,
math_Vector & theG ) const
inline

Evaluates both value and gradient.

Parameters
[in]theXinput vector
[out]theYfunction value
[out]theGgradient vector
Returns
true if evaluation succeeded

The documentation for this class was generated from the following file: