OpenSim Moco
0.4.0
|
A description of an optimal control problem, backed by OpenSim Models.
A MocoProblem is a series of phases, each of which contains the following:
Currently, only single-phase problems are supported. This class has convenience methods to configure the first (0-th) phase.
This class allows you to define your problem, but does not let you do anything with your problem (this class only contains user input). Use createRep() to create an instance of MocoProblemRep, which provides additional functionality.
#include <Moco/Moco/MocoProblem.h>
Public Member Functions | |
MocoPhase & | updPhase (int index=0) |
Get a modifiable phase of the problem by index (starting index of 0). More... | |
const MocoPhase & | getPhase (int index=0) const |
Get a modifiable phase of the problem by index (starting index of 0). More... | |
MocoProblemRep | createRep () const |
Create an instance of MocoProblemRep, which fills in additional state and control bounds, and allows you to apply parameter values and evaluate the goals. More... | |
Convenience methods for phase 0. | |
These methods allow you to conveniently edit phase 0 of the problem. See MocoPhase's documentation for more information. | |
Model * | setModel (std::unique_ptr< Model > model) |
Set the model to use for phase 0. More... | |
Model * | setModelCopy (Model model) |
Set the model to use for phase 0. More... | |
Model & | updModel () |
Update the model in phase 0. | |
void | setModelProcessor (ModelProcessor model) |
Set a model processor for phase 0. More... | |
void | setTimeBounds (const MocoInitialBounds &, const MocoFinalBounds &) |
Set time bounds for phase 0. | |
void | printStateNamesWithSubstring (const std::string &name) |
Find and print the names of all state variables containing a substring. | |
void | setStateInfo (const std::string &name, const MocoBounds &, const MocoInitialBounds &={}, const MocoFinalBounds &={}) |
Set bounds for a state variable for phase 0. | |
void | setStateInfoPattern (const std::string &pattern, const MocoBounds &bounds, const MocoInitialBounds &init={}, const MocoFinalBounds &final={}) |
Set bounds for all state variables for phase 0 whose path matches the provided pattern. More... | |
void | printControlNamesWithSubstring (const std::string &name) |
Find and print the names of all state variables containing a substring. | |
void | setControlInfo (const std::string &name, const MocoBounds &, const MocoInitialBounds &={}, const MocoFinalBounds &={}) |
Set bounds for a control variable for phase 0. | |
void | setControlInfoPattern (const std::string &pattern, const MocoBounds &, const MocoInitialBounds &={}, const MocoFinalBounds &={}) |
Set bounds for a control variable using a regular expression. | |
void | setKinematicConstraintBounds (const MocoBounds &bounds) |
Set bounds for the kinematic constraints in phase 0. | |
void | setMultiplierBounds (const MocoBounds &bounds) |
Set bounds for the Lagrange multipliers in phase 0. | |
template<typename MocoParamType = MocoParameter, typename... Args> | |
MocoParamType * | addParameter (Args &&... args) |
Add a parameter variable for phase 0. More... | |
template<typename MocoParamType = MocoParameter> | |
MocoParamType * | addParameter (std::unique_ptr< MocoParamType > param) |
Add a parameter variable for phase 0. | |
template<typename MocoGoalType , typename... Args> | |
MocoGoalType * | addGoal (Args &&... args) |
Add a goal for phase 0. More... | |
template<typename MocoGoalType > | |
MocoGoalType * | addGoal (std::unique_ptr< MocoGoalType > goal) |
Add a goal for phase 0. | |
MocoGoal & | updGoal (const std::string &name) |
Returns a reference to the goal with name "name" in phase 0. | |
template<typename MocoPCType , typename... Args> | |
MocoPCType * | addPathConstraint (Args &&... args) |
Add a constraint for phase 0. More... | |
template<typename MocoPCType > | |
MocoPCType * | addPathConstraint (std::unique_ptr< MocoPCType > pc) |
Add a constraint for phase 0. | |
Public Attributes | |
friend | MocoProblemRep |
Protected Member Functions | |
OpenSim_DECLARE_LIST_PROPERTY_SIZE (phases, MocoPhase, 1, "List of 1 or more MocoPhases.") | |
|
inline |
Add a goal for phase 0.
|
inline |
Add a parameter variable for phase 0.
|
inline |
Add a constraint for phase 0.
|
inline |
Create an instance of MocoProblemRep, which fills in additional state and control bounds, and allows you to apply parameter values and evaluate the goals.
This function will check your problem for various errors.
|
inline |
Get a modifiable phase of the problem by index (starting index of 0).
This accesses the internal phases property.
Model* OpenSim::MocoProblem::setModel | ( | std::unique_ptr< Model > | model | ) |
Set the model to use for phase 0.
Model* OpenSim::MocoProblem::setModelCopy | ( | Model | model | ) |
Set the model to use for phase 0.
void OpenSim::MocoProblem::setModelProcessor | ( | ModelProcessor | model | ) |
Set a model processor for phase 0.
void OpenSim::MocoProblem::setStateInfoPattern | ( | const std::string & | pattern, |
const MocoBounds & | bounds, | ||
const MocoInitialBounds & | init = {} , |
||
const MocoFinalBounds & | final = {} |
||
) |
Set bounds for all state variables for phase 0 whose path matches the provided pattern.
|
inline |
Get a modifiable phase of the problem by index (starting index of 0).
This accesses the internal phases property.