OpenMD 3.2
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
QuantLib::Problem Class Reference

Constrained optimization problem. More...

#include <Problem.hpp>

Public Member Functions

 Problem (ObjectiveFunction &objectiveFunction, Constraint &constraint, OpenMD::StatusFunction &statFunc, const DynamicVector< RealType > &initialValue=DynamicVector< RealType >())
 default constructor
void reset ()
RealType value (const DynamicVector< RealType > &x)
 call objective function computation and increment evaluation counter
void gradient (DynamicVector< RealType > &grad_f, const DynamicVector< RealType > &x)
 call objective function gradient computation and increment
RealType valueAndGradient (DynamicVector< RealType > &grad_f, const DynamicVector< RealType > &x)
 call objective function computation and it gradient
Constraintconstraint () const
 Constraint.
ObjectiveFunctionobjectiveFunction () const
 Objective function.
void setCurrentValue (const DynamicVector< RealType > &currentValue)
const DynamicVector< RealType > & currentValue () const
 current value of the local minimum
void setFunctionValue (RealType functionValue)
RealType functionValue () const
 value of objective function
void setGradientNormValue (RealType squaredNorm)
RealType gradientNormValue () const
 value of objective function gradient norm
int functionEvaluation () const
 number of evaluation of objective function
int gradientEvaluation () const
 number of evaluation of objective function gradient
RealType DotProduct (DynamicVector< RealType > &v1, DynamicVector< RealType > &v2)
RealType computeGradientNormValue (DynamicVector< RealType > &grad_f)

Protected Attributes

ObjectiveFunctionobjectiveFunction_
 Unconstrained objective function.
Constraintconstraint_
 Constraint.
DynamicVector< RealType > currentValue_
 current value of the local minimum
RealType functionValue_
 function and gradient norm values at the curentValue_ (i.e. the last step)
RealType squaredNorm_
int functionEvaluation_
 number of evaluation of objective function and its gradient
int gradientEvaluation_
StatusFunctionstatusFunction_
 status function

Detailed Description

Constrained optimization problem.

Definition at line 37 of file Problem.hpp.

Constructor & Destructor Documentation

◆ Problem()

QuantLib::Problem::Problem ( ObjectiveFunction & objectiveFunction,
Constraint & constraint,
OpenMD::StatusFunction & statFunc,
const DynamicVector< RealType > & initialValue = DynamicVector<RealType>() )
inline

default constructor

Definition at line 40 of file Problem.hpp.

References constraint(), constraint_, currentValue_, objectiveFunction(), objectiveFunction_, and statusFunction_.

Member Function Documentation

◆ computeGradientNormValue()

RealType QuantLib::Problem::computeGradientNormValue ( DynamicVector< RealType > & grad_f)

Definition at line 12 of file Problem.cpp.

◆ constraint()

Constraint & QuantLib::Problem::constraint ( ) const
inline

Constraint.

Definition at line 65 of file Problem.hpp.

References constraint_.

Referenced by QuantLib::ArmijoLineSearch::operator()(), and Problem().

◆ currentValue()

const DynamicVector< RealType > & QuantLib::Problem::currentValue ( ) const
inline

current value of the local minimum

Definition at line 77 of file Problem.hpp.

References currentValue_.

Referenced by QuantLib::LineSearchBasedMethod::minimize(), and QuantLib::ArmijoLineSearch::operator()().

◆ DotProduct()

RealType QuantLib::Problem::DotProduct ( DynamicVector< RealType > & v1,
DynamicVector< RealType > & v2 )

Definition at line 6 of file Problem.cpp.

◆ functionEvaluation()

int QuantLib::Problem::functionEvaluation ( ) const
inline

number of evaluation of objective function

Definition at line 95 of file Problem.hpp.

References functionEvaluation_.

◆ functionValue()

RealType QuantLib::Problem::functionValue ( ) const
inline

value of objective function

Definition at line 86 of file Problem.hpp.

References functionValue_.

Referenced by QuantLib::LineSearchBasedMethod::minimize(), and QuantLib::ArmijoLineSearch::operator()().

◆ gradient()

void QuantLib::Problem::gradient ( DynamicVector< RealType > & grad_f,
const DynamicVector< RealType > & x )
inline

call objective function gradient computation and increment

Definition at line 130 of file Problem.hpp.

References objectiveFunction_.

Referenced by QuantLib::ArmijoLineSearch::operator()().

◆ gradientEvaluation()

int QuantLib::Problem::gradientEvaluation ( ) const
inline

number of evaluation of objective function gradient

Definition at line 98 of file Problem.hpp.

◆ gradientNormValue()

RealType QuantLib::Problem::gradientNormValue ( ) const
inline

value of objective function gradient norm

Definition at line 92 of file Problem.hpp.

Referenced by QuantLib::LineSearchBasedMethod::minimize(), and QuantLib::ArmijoLineSearch::operator()().

◆ objectiveFunction()

ObjectiveFunction & QuantLib::Problem::objectiveFunction ( ) const
inline

Objective function.

Definition at line 68 of file Problem.hpp.

References objectiveFunction_.

Referenced by Problem().

◆ reset()

void QuantLib::Problem::reset ( )
inline
Warning
it does not reset the current minumum to any initial value

Definition at line 146 of file Problem.hpp.

References functionEvaluation_, and functionValue_.

Referenced by QuantLib::LineSearchBasedMethod::minimize().

◆ setCurrentValue()

void QuantLib::Problem::setCurrentValue ( const DynamicVector< RealType > & currentValue)
inline

Definition at line 70 of file Problem.hpp.

◆ setFunctionValue()

void QuantLib::Problem::setFunctionValue ( RealType functionValue)
inline

Definition at line 81 of file Problem.hpp.

◆ setGradientNormValue()

void QuantLib::Problem::setGradientNormValue ( RealType squaredNorm)
inline

Definition at line 88 of file Problem.hpp.

◆ value()

RealType QuantLib::Problem::value ( const DynamicVector< RealType > & x)
inline

call objective function computation and increment evaluation counter

Definition at line 121 of file Problem.hpp.

References currentValue_, functionEvaluation_, functionValue_, objectiveFunction_, and statusFunction_.

Referenced by QuantLib::ArmijoLineSearch::operator()().

◆ valueAndGradient()

RealType QuantLib::Problem::valueAndGradient ( DynamicVector< RealType > & grad_f,
const DynamicVector< RealType > & x )
inline

call objective function computation and it gradient

Definition at line 136 of file Problem.hpp.

References currentValue_, functionEvaluation_, functionValue_, objectiveFunction_, and statusFunction_.

Referenced by QuantLib::LineSearchBasedMethod::minimize().

Member Data Documentation

◆ constraint_

Constraint& QuantLib::Problem::constraint_
protected

Constraint.

Definition at line 108 of file Problem.hpp.

Referenced by constraint(), and Problem().

◆ currentValue_

DynamicVector<RealType> QuantLib::Problem::currentValue_
protected

current value of the local minimum

Definition at line 110 of file Problem.hpp.

Referenced by currentValue(), Problem(), value(), and valueAndGradient().

◆ functionEvaluation_

int QuantLib::Problem::functionEvaluation_
protected

number of evaluation of objective function and its gradient

Definition at line 115 of file Problem.hpp.

Referenced by functionEvaluation(), reset(), value(), and valueAndGradient().

◆ functionValue_

RealType QuantLib::Problem::functionValue_
protected

function and gradient norm values at the curentValue_ (i.e. the last step)

Definition at line 113 of file Problem.hpp.

Referenced by functionValue(), reset(), value(), and valueAndGradient().

◆ gradientEvaluation_

int QuantLib::Problem::gradientEvaluation_
protected

Definition at line 115 of file Problem.hpp.

◆ objectiveFunction_

ObjectiveFunction& QuantLib::Problem::objectiveFunction_
protected

Unconstrained objective function.

Definition at line 106 of file Problem.hpp.

Referenced by gradient(), objectiveFunction(), Problem(), value(), and valueAndGradient().

◆ squaredNorm_

RealType QuantLib::Problem::squaredNorm_
protected

Definition at line 113 of file Problem.hpp.

◆ statusFunction_

StatusFunction& QuantLib::Problem::statusFunction_
protected

status function

Definition at line 117 of file Problem.hpp.

Referenced by Problem(), value(), and valueAndGradient().


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