ModularFunction uses C++11 std::function to allow you to easily swap out the cost function, gradient function, and Hessian function during runtime for an optimizer::Function instance.
More...
#include <Function.hpp>
ModularFunction uses C++11 std::function to allow you to easily swap out the cost function, gradient function, and Hessian function during runtime for an optimizer::Function instance.
◆ ModularFunction()
dart::optimizer::ModularFunction::ModularFunction |
( |
const std::string & |
_name = "modular_function" | ) |
|
|
explicit |
◆ ~ModularFunction()
dart::optimizer::ModularFunction::~ModularFunction |
( |
| ) |
|
|
override |
◆ clearCostFunction()
void dart::optimizer::ModularFunction::clearCostFunction |
( |
bool |
_printWarning = true | ) |
|
Replace the cost function with a constant-zero function.
Passing in true will cause a warning to be printed out whenever eval() is called.
◆ clearGradientFunction()
void dart::optimizer::ModularFunction::clearGradientFunction |
( |
| ) |
|
◆ clearHessianFunction()
void dart::optimizer::ModularFunction::clearHessianFunction |
( |
| ) |
|
◆ eval()
double dart::optimizer::ModularFunction::eval |
( |
const Eigen::VectorXd & |
_x | ) |
|
|
overridevirtual |
◆ evalGradient() [1/2]
void dart::optimizer::ModularFunction::evalGradient |
( |
const Eigen::VectorXd & |
_x, |
|
|
Eigen::Map< Eigen::VectorXd > |
_grad |
|
) |
| |
|
overridevirtual |
◆ evalGradient() [2/2]
void dart::optimizer::Function::evalGradient |
( |
const Eigen::VectorXd & |
_x, |
|
|
Eigen::VectorXd & |
_grad |
|
) |
| |
|
inherited |
◆ evalHessian()
void dart::optimizer::ModularFunction::evalHessian |
( |
const Eigen::VectorXd & |
_x, |
|
|
Eigen::Map< Eigen::VectorXd, Eigen::RowMajor > |
_Hess |
|
) |
| |
|
overridevirtual |
◆ getName()
const std::string & dart::optimizer::Function::getName |
( |
| ) |
const |
|
inherited |
◆ setCostFunction()
void dart::optimizer::ModularFunction::setCostFunction |
( |
CostFunction |
_cost | ) |
|
Set the function that gets called by eval()
◆ setGradientFunction()
void dart::optimizer::ModularFunction::setGradientFunction |
( |
GradientFunction |
_gradient | ) |
|
◆ setHessianFunction()
void dart::optimizer::ModularFunction::setHessianFunction |
( |
HessianFunction |
_hessian | ) |
|
◆ setName()
void dart::optimizer::Function::setName |
( |
const std::string & |
newName | ) |
|
|
virtualinherited |
◆ mCostFunction
CostFunction dart::optimizer::ModularFunction::mCostFunction |
|
protected |
Storage for the cost function.
◆ mGradientFunction
Storage for the gradient function.
◆ mHessianFunction
Storage for the Hessian function.
◆ mName
std::string dart::optimizer::Function::mName |
|
protectedinherited |