OpenSim Moco  0.2.0
Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
OpenSim::MocoSolver Class Referenceabstract

Description

Once the solver is created, you should not make any edits to the MocoProblem.

If you do, you must call resetProblem(const MocoProblem& problem).

Inheritance diagram for OpenSim::MocoSolver:
OpenSim::MocoDirectCollocationSolver OpenSim::MocoCasADiSolver OpenSim::MocoTropterSolver

#include <Moco/Moco/MocoSolver.h>

Public Member Functions

 MocoSolver (const MocoProblem &problem)
 This calls resetProblem() with the provided problem.
 
void resetProblem (const MocoProblem &problem)
 Call this to prepare the solver for use on the provided problem.
 
MocoTrajectory createGuessTimeStepping () const
 (Experimental) Run a forward simulation (using the OpenSim Manager, which uses a SimTK::Integrator), using the default controls for actuators and the default states as the initial states, to create a guess that is dynamically consistent (constraint errors should be small). More...
 

Protected Member Functions

const MocoProblemRepgetProblemRep () const
 
std::unique_ptr< ThreadsafeJar< const MocoProblemRep > > createProblemRepJar (int size) const
 Create a library of MocoProblemReps for use in parallelized code.
 

Static Protected Member Functions

static void setSolutionStats (MocoSolution &, bool success, double objective, const std::string &status, int numIterations, double duration)
 This is a service for derived classes, because MocoSolution::setStatus(), MocoSolution::setSuccess(), etc. More...
 

Member Function Documentation

◆ createGuessTimeStepping()

MocoTrajectory OpenSim::MocoSolver::createGuessTimeStepping ( ) const

(Experimental) Run a forward simulation (using the OpenSim Manager, which uses a SimTK::Integrator), using the default controls for actuators and the default states as the initial states, to create a guess that is dynamically consistent (constraint errors should be small).

The time range for the simulation is the upper bound on the initial time and the lower bound on the final time. The initial state values are the default state values unless:

  • initial bounds are an equality constraint: use the bound value
  • default value is not within the initial bounds: use midpoint of initial bounds.

The number of times in the trajectory is the number of successful integration steps.

Note
This function does not yet support problems with parameters.
Exceptions
ExceptionIf the lower bound on the final time is less than or equal to the upper bound on the initial time. This situation is okay in general; it's just that this function doesn't support it.
Precondition(s):
You must have called resetProblem().

◆ setSolutionStats()

static void OpenSim::MocoSolver::setSolutionStats ( MocoSolution ,
bool  success,
double  objective,
const std::string &  status,
int  numIterations,
double  duration 
)
staticprotected

This is a service for derived classes, because MocoSolution::setStatus(), MocoSolution::setSuccess(), etc.

are private but this class is a friend of MocoSolution.


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