Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
corbo::ShootingGridBase Class Referenceabstract

#include <shooting_grid_base.h>

Inheritance diagram for corbo::ShootingGridBase:
Inheritance graph
[legend]

Classes

struct  ShootingInterval
 

Public Types

using Ptr = std::shared_ptr< ShootingGridBase >
 
using UPtr = std::unique_ptr< ShootingGridBase >
 
- Public Types inherited from corbo::DiscretizationGridInterface
using Ptr = std::shared_ptr< DiscretizationGridInterface >
 
using UPtr = std::unique_ptr< DiscretizationGridInterface >
 
- Public Types inherited from corbo::VertexSetInterface
using Ptr = std::shared_ptr< VertexSetInterface >
 

Public Member Functions

void clear () override
 
std::vector< VertexInterface * > & getActiveVertices () override
 
double getDt () const
 
double getDtRef () const
 
double getFinalTime () const override
 
bool getFirstControlInput (Eigen::VectorXd &u0) override
 
double getFirstDt () const override
 
double getInitialDt () const override
 
int getInitialN () const override
 
DiscretizationGridInterface::Ptr getInstance () const override=0
 Return a newly created shared instance of the implemented class. More...
 
int getN () const override
 
int getNRef () const
 
void getStateAndControlTimeSeries (TimeSeries::Ptr x_sequence, TimeSeries::Ptr u_sequence, double t_max=CORBO_INF_DBL) const override
 Return state and control trajectory as time series object (shared instance) More...
 
void getVertices (std::vector< VertexInterface *> &vertices) override
 
bool hasConstantControls () const override
 
bool hasSingleDt () const override
 
bool isEmpty () const override
 
bool isTimeVariableGrid () const override
 
bool isUniformGrid () const override
 
bool isValid () const
 
bool providesStateTrajectory () const override
 
void setConsiderIntermediateStateConstraints (bool active)
 
void setDtRef (double dt)
 
void setInitialDt (double dt) override
 
void setN (int n, bool try_resample=true) override
 Return dimension of the control input dimension in the grid. More...
 
void setNRef (int n)
 
void setNumControlsPerShootingInterval (int num_u_per_interv)
 
void setNumControlsPerShootingInterval (int num_u_per_interv, bool intermediate_x_constraints)
 
void setNumericalIntegrator (NumericalIntegratorExplicitInterface::Ptr integrator)
 
void setWarmStart (bool active)
 
void setXfFixed (const Eigen::Matrix< bool, -1, 1 > &xf_fixed)
 
 ShootingGridBase ()=default
 
GridUpdateResult update (const Eigen::VectorXd &x0, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics, bool new_run, const Time &t, ReferenceTrajectoryInterface *sref=nullptr, const Eigen::VectorXd *prev_u=nullptr, double prev_u_dt=0, ReferenceTrajectoryInterface *xinit=nullptr, ReferenceTrajectoryInterface *uinit=nullptr) override
 
virtual ~ShootingGridBase ()=default
 
- Public Member Functions inherited from corbo::DiscretizationGridInterface
 DiscretizationGridInterface ()=default
 
 DiscretizationGridInterface (int state_dim, int control_dim)
 
virtual ~DiscretizationGridInterface ()=default
 Virtual destructor. More...
 
- Public Member Functions inherited from corbo::VertexSetInterface
void applyIncrementNonFixed (const Eigen::Ref< const Eigen::VectorXd > &increment)
 Active vertices related methods. More...
 
void applyIncrementNonFixed (int idx, double increment)
 
void backupParametersActiveVertices ()
 
void clearConnectedEdges ()
 
void computeVertexIndices ()
 Precompute vertex indices in the hyper-graph (e.g. for the Jacobian or Hessian structure) More...
 
void discardBackupParametersActiveVertices (bool all=false)
 
void getBounds (Eigen::Ref< Eigen::VectorXd > lb, Eigen::Ref< Eigen::VectorXd > ub)
 
double getLowerBound (int idx)
 
int getParameterDimension ()
 
double getParameterValue (int idx)
 
void getParameterVector (Eigen::Ref< Eigen::VectorXd > x)
 
double getUpperBound (int idx)
 
bool isModified () const
 
void restoreBackupParametersActiveVertices (bool keep_backup)
 
void setBounds (const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub)
 
void setLowerBound (int idx, double lb)
 
void setModified (bool modified)
 
void setParameterValue (int idx, double x)
 
void setParameterVector (const Eigen::Ref< const Eigen::VectorXd > &x)
 
void setUpperBound (int idx, double ub)
 
 VertexSetInterface ()
 
virtual ~VertexSetInterface ()
 Virtual destructor. More...
 

Protected Member Functions

virtual bool adaptGrid (bool new_run, NlpFunctions &nlp_fun)
 
bool checkAndInitializeXfFixedFlags (int dim_x)
 
void computeActiveVertices () override
 
virtual void createEdges (NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics)=0
 
int findNearestShootingInterval (const Eigen::VectorXd &x0)
 
void initializeSequences (const Eigen::VectorXd &x0, const Eigen::VectorXd &xf, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun)
 
void initializeSequences (const Eigen::VectorXd &x0, const Eigen::VectorXd &xf, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun)
 
virtual bool isDtFixedIntended () const
 
virtual bool isGridAdaptActive () const
 
virtual bool isMovingHorizonWarmStartActive () const
 
virtual bool isXfShootingNode () const
 
void resampleTrajectory (int n_new, NlpFunctions &nlp_fun)
 
void updateBounds (const NlpFunctions &nlp_fun)
 
void warmStartShifting (const Eigen::VectorXd &x0)
 
- Protected Member Functions inherited from corbo::DiscretizationGridInterface
void setLastControlRef (const Eigen::VectorXd &last_u_ref)
 
void setPreviousControl (const Eigen::VectorXd &prev_u, double prev_u_dt)
 
- Protected Member Functions inherited from corbo::VertexSetInterface
void setVertexIdx (VertexInterface &vertex, int idx)
 

Protected Attributes

std::vector< VertexInterface * > _active_vertices
 
ScalarVertex _dt
 
double _dt_lb = 0
 
double _dt_ref = 0.1
 
double _dt_ub = CORBO_INF_DBL
 
bool _first_run = true
 
bool _full_discretization = true
 
NumericalIntegratorExplicitInterface::Ptr _integrator
 
bool _intermediate_x_constraints = false
 
std::vector< ShootingInterval_intervals
 
int _n_adapt = 0
 
int _n_ref = 11
 
int _num_u_per_interv_ref = 1
 
bool _warm_start = false
 
PartiallyFixedVectorVertex _xf
 
Eigen::Matrix< bool, -1, 1 > _xf_fixed
 
- Protected Attributes inherited from corbo::DiscretizationGridInterface
VectorVertex _u_prev
 
ScalarVertex _u_prev_dt
 
VectorVertex _u_ref
 
- Protected Attributes inherited from corbo::VertexSetInterface
bool _modified = true
 

Additional Inherited Members

- Static Public Member Functions inherited from corbo::DiscretizationGridInterface
static Factory< DiscretizationGridInterface > & getFactory ()
 Get access to the accociated factory. More...
 

Detailed Description

Definition at line 39 of file shooting_grid_base.h.

Member Typedef Documentation

◆ Ptr

Definition at line 42 of file shooting_grid_base.h.

◆ UPtr

Definition at line 43 of file shooting_grid_base.h.

Constructor & Destructor Documentation

◆ ShootingGridBase()

corbo::ShootingGridBase::ShootingGridBase ( )
default

◆ ~ShootingGridBase()

virtual corbo::ShootingGridBase::~ShootingGridBase ( )
virtualdefault

Member Function Documentation

◆ adaptGrid()

virtual bool corbo::ShootingGridBase::adaptGrid ( bool  new_run,
NlpFunctions nlp_fun 
)
inlineprotectedvirtual

Reimplemented in corbo::MultipleShootingVariableGrid.

Definition at line 129 of file shooting_grid_base.h.

◆ checkAndInitializeXfFixedFlags()

bool corbo::ShootingGridBase::checkAndInitializeXfFixedFlags ( int  dim_x)
protected

Definition at line 426 of file shooting_grid_base.cpp.

◆ clear()

void corbo::ShootingGridBase::clear ( )
overridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 556 of file shooting_grid_base.cpp.

◆ computeActiveVertices()

void corbo::ShootingGridBase::computeActiveVertices ( )
overrideprotectedvirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 583 of file shooting_grid_base.cpp.

◆ createEdges()

virtual void corbo::ShootingGridBase::createEdges ( NlpFunctions nlp_fun,
OptimizationEdgeSet edges,
SystemDynamicsInterface::Ptr  dynamics 
)
protectedpure virtual

Implemented in corbo::MultipleShootingGrid.

◆ findNearestShootingInterval()

int corbo::ShootingGridBase::findNearestShootingInterval ( const Eigen::VectorXd &  x0)
protected

Definition at line 356 of file shooting_grid_base.cpp.

◆ getActiveVertices()

std::vector<VertexInterface*>& corbo::ShootingGridBase::getActiveVertices ( )
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 115 of file shooting_grid_base.h.

◆ getDt()

double corbo::ShootingGridBase::getDt ( ) const
inline

Definition at line 101 of file shooting_grid_base.h.

◆ getDtRef()

double corbo::ShootingGridBase::getDtRef ( ) const
inline

Definition at line 100 of file shooting_grid_base.h.

◆ getFinalTime()

double corbo::ShootingGridBase::getFinalTime ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 64 of file shooting_grid_base.h.

◆ getFirstControlInput()

bool corbo::ShootingGridBase::getFirstControlInput ( Eigen::VectorXd &  u0)
overridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 393 of file shooting_grid_base.cpp.

◆ getFirstDt()

double corbo::ShootingGridBase::getFirstDt ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 63 of file shooting_grid_base.h.

◆ getInitialDt()

double corbo::ShootingGridBase::getInitialDt ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 87 of file shooting_grid_base.h.

◆ getInitialN()

int corbo::ShootingGridBase::getInitialN ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 88 of file shooting_grid_base.h.

◆ getInstance()

DiscretizationGridInterface::Ptr corbo::ShootingGridBase::getInstance ( ) const
overridepure virtual

Return a newly created shared instance of the implemented class.

Implements corbo::DiscretizationGridInterface.

Implemented in corbo::MultipleShootingVariableGrid, and corbo::MultipleShootingGrid.

◆ getN()

int corbo::ShootingGridBase::getN ( ) const
overridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 401 of file shooting_grid_base.cpp.

◆ getNRef()

int corbo::ShootingGridBase::getNRef ( ) const
inline

Definition at line 90 of file shooting_grid_base.h.

◆ getStateAndControlTimeSeries()

void corbo::ShootingGridBase::getStateAndControlTimeSeries ( TimeSeries::Ptr  x_sequence,
TimeSeries::Ptr  u_sequence,
double  t_max = CORBO_INF_DBL 
) const
overridevirtual

Return state and control trajectory as time series object (shared instance)

Implements corbo::DiscretizationGridInterface.

Definition at line 600 of file shooting_grid_base.cpp.

◆ getVertices()

void corbo::ShootingGridBase::getVertices ( std::vector< VertexInterface *> &  vertices)
overridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 567 of file shooting_grid_base.cpp.

◆ hasConstantControls()

bool corbo::ShootingGridBase::hasConstantControls ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 66 of file shooting_grid_base.h.

◆ hasSingleDt()

bool corbo::ShootingGridBase::hasSingleDt ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 67 of file shooting_grid_base.h.

◆ initializeSequences() [1/2]

void corbo::ShootingGridBase::initializeSequences ( const Eigen::VectorXd &  x0,
const Eigen::VectorXd &  xf,
ReferenceTrajectoryInterface uref,
NlpFunctions nlp_fun 
)
protected

Definition at line 141 of file shooting_grid_base.cpp.

◆ initializeSequences() [2/2]

void corbo::ShootingGridBase::initializeSequences ( const Eigen::VectorXd &  x0,
const Eigen::VectorXd &  xf,
ReferenceTrajectoryInterface xref,
ReferenceTrajectoryInterface uref,
NlpFunctions nlp_fun 
)
protected

Definition at line 216 of file shooting_grid_base.cpp.

◆ isDtFixedIntended()

virtual bool corbo::ShootingGridBase::isDtFixedIntended ( ) const
inlineprotectedvirtual

◆ isEmpty()

bool corbo::ShootingGridBase::isEmpty ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 78 of file shooting_grid_base.h.

◆ isGridAdaptActive()

virtual bool corbo::ShootingGridBase::isGridAdaptActive ( ) const
inlineprotectedvirtual

Reimplemented in corbo::MultipleShootingVariableGrid.

Definition at line 143 of file shooting_grid_base.h.

◆ isMovingHorizonWarmStartActive()

virtual bool corbo::ShootingGridBase::isMovingHorizonWarmStartActive ( ) const
inlineprotectedvirtual

Reimplemented in corbo::MultipleShootingVariableGrid.

Definition at line 142 of file shooting_grid_base.h.

◆ isTimeVariableGrid()

bool corbo::ShootingGridBase::isTimeVariableGrid ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 68 of file shooting_grid_base.h.

◆ isUniformGrid()

bool corbo::ShootingGridBase::isUniformGrid ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 69 of file shooting_grid_base.h.

◆ isValid()

bool corbo::ShootingGridBase::isValid ( ) const
inline

Definition at line 79 of file shooting_grid_base.h.

◆ isXfShootingNode()

virtual bool corbo::ShootingGridBase::isXfShootingNode ( ) const
inlineprotectedvirtual

Definition at line 148 of file shooting_grid_base.h.

◆ providesStateTrajectory()

bool corbo::ShootingGridBase::providesStateTrajectory ( ) const
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 70 of file shooting_grid_base.h.

◆ resampleTrajectory()

void corbo::ShootingGridBase::resampleTrajectory ( int  n_new,
NlpFunctions nlp_fun 
)
protected
Todo:
(roesmann) More efficient strategy without copying containers at all?

Definition at line 473 of file shooting_grid_base.cpp.

◆ setConsiderIntermediateStateConstraints()

void corbo::ShootingGridBase::setConsiderIntermediateStateConstraints ( bool  active)
inline

Definition at line 104 of file shooting_grid_base.h.

◆ setDtRef()

void corbo::ShootingGridBase::setDtRef ( double  dt)
inline

Definition at line 99 of file shooting_grid_base.h.

◆ setInitialDt()

void corbo::ShootingGridBase::setInitialDt ( double  dt)
inlineoverridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 86 of file shooting_grid_base.h.

◆ setN()

void corbo::ShootingGridBase::setN ( int  n,
bool  try_resample = true 
)
inlineoverridevirtual

Return dimension of the control input dimension in the grid.

Implements corbo::DiscretizationGridInterface.

Definition at line 81 of file shooting_grid_base.h.

◆ setNRef()

void corbo::ShootingGridBase::setNRef ( int  n)

Definition at line 412 of file shooting_grid_base.cpp.

◆ setNumControlsPerShootingInterval() [1/2]

void corbo::ShootingGridBase::setNumControlsPerShootingInterval ( int  num_u_per_interv)
inline

Definition at line 92 of file shooting_grid_base.h.

◆ setNumControlsPerShootingInterval() [2/2]

void corbo::ShootingGridBase::setNumControlsPerShootingInterval ( int  num_u_per_interv,
bool  intermediate_x_constraints 
)
inline

Definition at line 93 of file shooting_grid_base.h.

◆ setNumericalIntegrator()

void corbo::ShootingGridBase::setNumericalIntegrator ( NumericalIntegratorExplicitInterface::Ptr  integrator)
inline

Definition at line 106 of file shooting_grid_base.h.

◆ setWarmStart()

void corbo::ShootingGridBase::setWarmStart ( bool  active)
inline

Definition at line 102 of file shooting_grid_base.h.

◆ setXfFixed()

void corbo::ShootingGridBase::setXfFixed ( const Eigen::Matrix< bool, -1, 1 > &  xf_fixed)
inline

Definition at line 108 of file shooting_grid_base.h.

◆ update()

GridUpdateResult corbo::ShootingGridBase::update ( const Eigen::VectorXd &  x0,
ReferenceTrajectoryInterface xref,
ReferenceTrajectoryInterface uref,
NlpFunctions nlp_fun,
OptimizationEdgeSet edges,
SystemDynamicsInterface::Ptr  dynamics,
bool  new_run,
const Time t,
ReferenceTrajectoryInterface sref = nullptr,
const Eigen::VectorXd *  prev_u = nullptr,
double  prev_u_dt = 0,
ReferenceTrajectoryInterface xinit = nullptr,
ReferenceTrajectoryInterface uinit = nullptr 
)
overridevirtual

Implements corbo::DiscretizationGridInterface.

Definition at line 39 of file shooting_grid_base.cpp.

◆ updateBounds()

void corbo::ShootingGridBase::updateBounds ( const NlpFunctions nlp_fun)
protected

Definition at line 441 of file shooting_grid_base.cpp.

◆ warmStartShifting()

void corbo::ShootingGridBase::warmStartShifting ( const Eigen::VectorXd &  x0)
protected

Definition at line 292 of file shooting_grid_base.cpp.

Member Data Documentation

◆ _active_vertices

std::vector<VertexInterface*> corbo::ShootingGridBase::_active_vertices
protected

Definition at line 155 of file shooting_grid_base.h.

◆ _dt

ScalarVertex corbo::ShootingGridBase::_dt
protected

Definition at line 153 of file shooting_grid_base.h.

◆ _dt_lb

double corbo::ShootingGridBase::_dt_lb = 0
protected

Definition at line 167 of file shooting_grid_base.h.

◆ _dt_ref

double corbo::ShootingGridBase::_dt_ref = 0.1
protected

Definition at line 160 of file shooting_grid_base.h.

◆ _dt_ub

double corbo::ShootingGridBase::_dt_ub = CORBO_INF_DBL
protected

Definition at line 168 of file shooting_grid_base.h.

◆ _first_run

bool corbo::ShootingGridBase::_first_run = true
protected

Definition at line 163 of file shooting_grid_base.h.

◆ _full_discretization

bool corbo::ShootingGridBase::_full_discretization = true
protected

Definition at line 170 of file shooting_grid_base.h.

◆ _integrator

NumericalIntegratorExplicitInterface::Ptr corbo::ShootingGridBase::_integrator
protected

Definition at line 150 of file shooting_grid_base.h.

◆ _intermediate_x_constraints

bool corbo::ShootingGridBase::_intermediate_x_constraints = false
protected

Definition at line 171 of file shooting_grid_base.h.

◆ _intervals

std::vector<ShootingInterval> corbo::ShootingGridBase::_intervals
protected

Definition at line 152 of file shooting_grid_base.h.

◆ _n_adapt

int corbo::ShootingGridBase::_n_adapt = 0
protected

Definition at line 159 of file shooting_grid_base.h.

◆ _n_ref

int corbo::ShootingGridBase::_n_ref = 11
protected

Definition at line 158 of file shooting_grid_base.h.

◆ _num_u_per_interv_ref

int corbo::ShootingGridBase::_num_u_per_interv_ref = 1
protected

Definition at line 157 of file shooting_grid_base.h.

◆ _warm_start

bool corbo::ShootingGridBase::_warm_start = false
protected

Definition at line 162 of file shooting_grid_base.h.

◆ _xf

PartiallyFixedVectorVertex corbo::ShootingGridBase::_xf
protected

Definition at line 154 of file shooting_grid_base.h.

◆ _xf_fixed

Eigen::Matrix<bool, -1, 1> corbo::ShootingGridBase::_xf_fixed
protected

Definition at line 166 of file shooting_grid_base.h.


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


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:08:03