OpenSim Moco  0.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenSim::MocoBounds Class Reference

Description

Small struct to handle bounds.

Examples:
exampleMocoCustomEffortGoal.cpp, exampleSlidingMass.cpp, and exampleSlidingMassAdvanced.cpp.
Inheritance diagram for OpenSim::MocoBounds:
OpenSim::MocoFinalBounds OpenSim::MocoInitialBounds

#include <Moco/Moco/MocoBounds.h>

Public Member Functions

 MocoBounds ()
 The bounds are unset (NaN).
 
 MocoBounds (double value)
 The lower and upper bound are equal (the variable is constrained to this single value). More...
 
 MocoBounds (double lower, double upper)
 The variable is constrained to be within [lower, upper].
 
bool isSet () const
 True if the lower and upper bounds are both not NaN.
 
bool isEquality () const
 True if the lower and upper bounds are the same, resulting in an equality constraint. More...
 
bool isWithinBounds (const double &value) const
 Returns true if the provided value is within these bounds.
 
double getLower () const
 
double getUpper () const
 
Array< double > getAsArray () const
 The returned array has either 0, 1, or 2 elements. More...
 
void printDescription (std::ostream &stream) const
 

Static Public Member Functions

static MocoBounds unconstrained ()
 Create bounds that are (-inf, inf), so the variable is unconstrained.
 

Protected Member Functions

 MocoBounds (const Property< double > &p)
 Used internally to create Bounds from a list property. More...
 
 OpenSim_DECLARE_LIST_PROPERTY_ATMOST (bounds, double, 2, "1 value: required value. " "2 values: lower, upper bounds on value.")
 

Protected Attributes

friend MocoPhase
 
friend MocoVariableInfo
 
friend MocoParameter
 

Constructor & Destructor Documentation

◆ MocoBounds() [1/2]

OpenSim::MocoBounds::MocoBounds ( double  value)

The lower and upper bound are equal (the variable is constrained to this single value).

◆ MocoBounds() [2/2]

OpenSim::MocoBounds::MocoBounds ( const Property< double > &  p)
protected

Used internally to create Bounds from a list property.

The list property must have either 0, 1 or 2 elements.

Member Function Documentation

◆ getAsArray()

Array<double> OpenSim::MocoBounds::getAsArray ( ) const
inline

The returned array has either 0, 1, or 2 elements.

  • 0 elements: bounds are not set.
  • 1 element: equality constraint
  • 2 elements: range (inequality constraint).

◆ isEquality()

bool OpenSim::MocoBounds::isEquality ( ) const
inline

True if the lower and upper bounds are the same, resulting in an equality constraint.


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