This class provides an interface specification for static optimization Objective Function. More...
#include <StaticOptimizationTarget.h>
Public Member Functions | |
StaticOptimizationTarget (const SimTK::State &s, Model *aModel, int aNX, int aNC, const bool useMusclePhysiology=true) | |
Construct an optimization target. | |
void | setModel (Model &aModel) |
______________________________________________________________________________ | |
void | setStatesStore (const Storage *aStatesStore) |
______________________________________________________________________________ | |
void | setStatesSplineSet (GCVSplineSet aStatesSplineSet) |
______________________________________________________________________________ | |
void | setNumParams (const int aNP) |
______________________________________________________________________________ | |
void | setNumConstraints (const int aNC) |
______________________________________________________________________________ | |
void | setDX (double aVal) |
Set the derivative perturbation size for all controls. | |
void | setDX (int aIndex, double aVal) |
Set the derivative perturbation size. | |
double | getDX (int aIndex) |
Get the derivative perturbation size. | |
double * | getDXArray () |
Get a pointer to the vector of derivative perturbation sizes. | |
void | getActuation (const SimTK::State &s, const SimTK::Vector ¶meters, SimTK::Vector &forces) |
Get an optimal force. | |
void | setActivationExponent (double aActivationExponent) |
double | getActivationExponent () const |
void | setCurrentState (const SimTK::State *state) |
const SimTK::State * | getCurrentState () const |
void | validatePerturbationSize (double &aSize) |
Ensure that a derivative perturbation is a valid size. | |
virtual void | printPerformance (const SimTK::State &s, double *x) |
void | computeActuatorAreas (const SimTK::State &s) |
bool | prepareToOptimize (const SimTK::State &s, double *x) |
int | objectiveFunc (const SimTK::Vector &x, const bool new_coefficients, SimTK::Real &rP) const |
int | gradientFunc (const SimTK::Vector &x, const bool new_coefficients, SimTK::Vector &gradient) const |
int | constraintFunc (const SimTK::Vector &x, const bool new_coefficients, SimTK::Vector &constraints) const |
Compute acceleration constraints given parameters. | |
int | constraintJacobian (const SimTK::Vector &x, const bool new_coefficients, SimTK::Matrix &jac) const |
Compute the gradient of constraint given parameters. | |
Static Public Member Functions | |
static int | CentralDifferencesConstraint (const StaticOptimizationTarget *aTarget, double *dx, const SimTK::Vector &x, SimTK::Matrix &jacobian) |
static int | CentralDifferences (const StaticOptimizationTarget *aTarget, double *dx, const SimTK::Vector &x, SimTK::Vector &dpdx) |
Static Public Attributes | |
static const double | SMALLDX = 1.0e-14 |
Smallest allowable perturbation size for computing derivatives. | |
Protected Attributes | |
double | _activationExponent |
bool | _useMusclePhysiology |
Array< double > | _dx |
Perturbation size for computing numerical derivatives. | |
Array< int > | _accelerationIndices |
This class provides an interface specification for static optimization Objective Function.
StaticOptimizationTarget::StaticOptimizationTarget | ( | const SimTK::State & | s, | |
Model * | aModel, | |||
int | aNP, | |||
int | aNC, | |||
const bool | useMusclePhysiology = true | |||
) |
Construct an optimization target.
aNP | The number of parameters. | |
aNC | The number of constraints. | |
aT | Current time in the integration. | |
aX | Current control values. | |
aY | Current states. | |
aDYDT | Current state derivatives. |
static int OpenSim::StaticOptimizationTarget::CentralDifferences | ( | const StaticOptimizationTarget * | aTarget, | |
double * | dx, | |||
const SimTK::Vector & | x, | |||
SimTK::Vector & | dpdx | |||
) | [static] |
static int OpenSim::StaticOptimizationTarget::CentralDifferencesConstraint | ( | const StaticOptimizationTarget * | aTarget, | |
double * | dx, | |||
const SimTK::Vector & | x, | |||
SimTK::Matrix & | jacobian | |||
) | [static] |
void StaticOptimizationTarget::computeActuatorAreas | ( | const SimTK::State & | s | ) |
int StaticOptimizationTarget::constraintFunc | ( | const SimTK::Vector & | parameters, | |
const bool | new_parameters, | |||
SimTK::Vector & | constraints | |||
) | const |
Compute acceleration constraints given parameters.
parameters | Vector of optimization parameters. | |
constraints | Vector of optimization constraints. |
int StaticOptimizationTarget::constraintJacobian | ( | const SimTK::Vector & | parameters, | |
const bool | new_parameters, | |||
SimTK::Matrix & | jac | |||
) | const |
Compute the gradient of constraint given parameters.
parameters | Vector of parameters. | |
jac | Derivative of constraint with respect to the parameters. |
double OpenSim::StaticOptimizationTarget::getActivationExponent | ( | ) | const [inline] |
void StaticOptimizationTarget::getActuation | ( | const SimTK::State & | s, | |
const SimTK::Vector & | parameters, | |||
SimTK::Vector & | forces | |||
) |
Get an optimal force.
const SimTK::State* OpenSim::StaticOptimizationTarget::getCurrentState | ( | ) | const [inline] |
double StaticOptimizationTarget::getDX | ( | int | aIndex | ) |
Get the derivative perturbation size.
double * StaticOptimizationTarget::getDXArray | ( | ) |
Get a pointer to the vector of derivative perturbation sizes.
int OpenSim::StaticOptimizationTarget::gradientFunc | ( | const SimTK::Vector & | x, | |
const bool | new_coefficients, | |||
SimTK::Vector & | gradient | |||
) | const |
int OpenSim::StaticOptimizationTarget::objectiveFunc | ( | const SimTK::Vector & | x, | |
const bool | new_coefficients, | |||
SimTK::Real & | rP | |||
) | const |
bool StaticOptimizationTarget::prepareToOptimize | ( | const SimTK::State & | s, | |
double * | x | |||
) |
void StaticOptimizationTarget::printPerformance | ( | const SimTK::State & | s, | |
double * | x | |||
) | [virtual] |
void OpenSim::StaticOptimizationTarget::setActivationExponent | ( | double | aActivationExponent | ) | [inline] |
void OpenSim::StaticOptimizationTarget::setCurrentState | ( | const SimTK::State * | state | ) | [inline] |
void StaticOptimizationTarget::setDX | ( | int | aIndex, | |
double | aVal | |||
) |
Set the derivative perturbation size.
void StaticOptimizationTarget::setDX | ( | double | aVal | ) |
Set the derivative perturbation size for all controls.
void StaticOptimizationTarget::setModel | ( | Model & | aModel | ) |
void StaticOptimizationTarget::setNumConstraints | ( | const int | aNC | ) |
______________________________________________________________________________
Set the number of constraints.
aNC | Number of constraints. |
void StaticOptimizationTarget::setNumParams | ( | const int | aNP | ) |
______________________________________________________________________________
Set the number of paramters.
The number of parameters can be set at any time. However, the perturbation sizes for the parameters (i.e., _dx) is destroyed. Therefore, the perturbation sizes must be reset.
aNP | Number of parameters. |
void StaticOptimizationTarget::setStatesSplineSet | ( | GCVSplineSet | aStatesSplineSet | ) |
______________________________________________________________________________
Set the states spline set.
aStatesSplineSet | States spline set. |
void StaticOptimizationTarget::setStatesStore | ( | const Storage * | aStatesStore | ) |
______________________________________________________________________________
Set the states storage.
aStatesStore | States storage. |
void StaticOptimizationTarget::validatePerturbationSize | ( | double & | aSize | ) |
Ensure that a derivative perturbation is a valid size.
Array<int> OpenSim::StaticOptimizationTarget::_accelerationIndices [protected] |
double OpenSim::StaticOptimizationTarget::_activationExponent [protected] |
Array<double> OpenSim::StaticOptimizationTarget::_dx [protected] |
Perturbation size for computing numerical derivatives.
bool OpenSim::StaticOptimizationTarget::_useMusclePhysiology [protected] |
const double StaticOptimizationTarget::SMALLDX = 1.0e-14 [static] |
Smallest allowable perturbation size for computing derivatives.