OpenSim Moco  0.4.0
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CasOC::Transcription Class Referenceabstract

Description

This is the base class for transcription schemes that convert a CasOC::Problem into a general nonlinear programming problem.

If you are creating a new derived class, make sure to override all virtual functions and obey the settings that the user specified in the CasOC::Solver.

Inheritance diagram for CasOC::Transcription:
CasOC::HermiteSimpson CasOC::Trapezoidal

#include <Moco/Moco/MocoCasADiSolver/CasOCTranscription.h>

Classes

struct  Constraints
 

Public Member Functions

 Transcription (const Solver &solver, const Problem &problem)
 
Iterate createInitialGuessFromBounds () const
 
Iterate createRandomIterateWithinBounds (const SimTK::Random *=nullptr) const
 Use the provided random number generator to generate an iterate. More...
 
template<typename T >
createTimes (const T &initialTime, const T &finalTime) const
 
casadi::DM createQuadratureCoefficients () const
 
casadi::DM createMeshIndices () const
 
Solution solve (const Iterate &guessOrig)
 

Protected Member Functions

void createVariablesAndSetBounds (const casadi::DM &grid, int numDefectsPerMeshInterval, const casadi::DM &pointsForInterpControls=casadi::DM())
 This must be called in the constructor of derived classes so that overridden virtual methods are accessible to the base class. More...
 
casadi::MXVector evalOnTrajectory (const casadi::Function &pointFunction, const std::vector< Var > &inputs, const casadi::Matrix< casadi_int > &timeIndices) const
 We assume all functions depend on time and parameters. More...
 
template<typename TRow , typename TColumn >
void setVariableBounds (Var var, const TRow &rowIndices, const TColumn &columnIndices, const Bounds &bounds)
 
void printConstraintValues (const Iterate &it, const Constraints< casadi::DM > &constraints, std::ostream &stream=std::cout) const
 
void printObjectiveBreakdown (const Iterate &it, const casadi::DM &objectiveTerms, std::ostream &stream=std::cout) const
 

Protected Attributes

const Solverm_solver
 
const Problemm_problem
 
int m_numGridPoints = -1
 
int m_numMeshPoints = -1
 
int m_numMeshIntervals = -1
 
int m_numMeshInteriorPoints = -1
 
int m_numDefectsPerMeshInterval = -1
 
int m_numMultibodyResiduals = -1
 
int m_numAuxiliaryResiduals = -1
 
int m_numConstraints = -1
 
casadi::DM m_grid
 
casadi::DM m_pointsForInterpControls
 
casadi::MX m_times
 
casadi::MX m_duration
 

Friends

class NlpsolCallback
 

Member Function Documentation

◆ createRandomIterateWithinBounds()

Iterate CasOC::Transcription::createRandomIterateWithinBounds ( const SimTK::Random *  = nullptr) const

Use the provided random number generator to generate an iterate.

Random::Uniform is used if a generator is not provided. The generator should produce numbers with [-1, 1].

◆ createVariablesAndSetBounds()

void CasOC::Transcription::createVariablesAndSetBounds ( const casadi::DM &  grid,
int  numDefectsPerMeshInterval,
const casadi::DM &  pointsForInterpControls = casadi::DM() 
)
protected

This must be called in the constructor of derived classes so that overridden virtual methods are accessible to the base class.

This implementation allows initialization to occur during construction, avoiding an extra call on the instantiated object. pointsForInterpControls are grid points at which the transcription scheme applies constraints between control points.

◆ evalOnTrajectory()

casadi::MXVector CasOC::Transcription::evalOnTrajectory ( const casadi::Function &  pointFunction,
const std::vector< Var > &  inputs,
const casadi::Matrix< casadi_int > &  timeIndices 
) const
protected

We assume all functions depend on time and parameters.

"inputs" is prepended by time and postpended (?) by parameters.


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