- 3.0.2 optimal control module.
ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR > Class Template Reference

This class can integrate a controlled system and a costfunction. Furthermore, it provides first order derivatives with respect to initial state and control. More...

#include <SensitivityIntegratorCT.h>

Public Types

typedef ct::core::ControlVector< CONTROL_DIM, SCALARcontrol_vector
 
typedef Eigen::Matrix< SCALAR, STATE_DIM, STATE_DIM > state_matrix
 
typedef Eigen::Matrix< SCALAR, CONTROL_DIM, CONTROL_DIM > control_matrix
 
typedef Eigen::Matrix< SCALAR, STATE_DIM, CONTROL_DIM > state_control_matrix
 

Public Member Functions

 SensitivityIntegratorCT (const std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &system, const ct::core::IntegrationType stepperType=ct::core::IntegrationType::EULERCT)
 Constructor. More...
 
 ~SensitivityIntegratorCT ()=default
 Destroys the object. More...
 
void initializeDerived (const ct::core::IntegrationType stepperType)
 Initializes the steppers. More...
 
void setLinearSystem (const std::shared_ptr< ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &linearSystem)
 Prepares the integrator to provide first order sensitivity generation by setting a linearsystem, enabling state caching and settings up the function objects. More...
 
void setControlledSystem (const std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &controlledSystem)
 Changes the controlledsystem to be integrated. More...
 
void setCostFunction (const std::shared_ptr< CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >> costFun)
 Prepares the integrator to provide cost integration and first order cost derivatives. This is done by enabling sensitivity caching and setting up the function objects. More...
 
void integrate (state_vector &state, const SCALAR startTime, const size_t numSteps, const SCALAR dt, ct::core::StateVectorArray< STATE_DIM, SCALAR > &stateTrajectory, ct::core::tpl::TimeArray< SCALAR > &timeTrajectory)
 Integrates the system starting from state and startTime for numSteps integration steps. Returns the full state and time trajectories. More...
 
void integrate (state_vector &state, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the system starting from state and startTime for numSteps integration steps. Returns only the final state and time. More...
 
void integrateSensitivityDX0 (state_matrix &dX0, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity ODE of the integrator with respec to the initial state x0. More...
 
void integrateSensitivityDU0 (state_control_matrix &dU0, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity ODE of the integrator with respec to the initial control input u0. More...
 
void integrateSensitivityDUf (state_control_matrix &dUf, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity ODE of the integrator with respec to the final control input uf. More...
 
void integrateCost (SCALAR &cost, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the costfunction using the states and controls from the costintegration. More...
 
void integrateCostSensitivityDX0 (state_vector &dX0, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity of the cost with respect to the initial state x0. More...
 
void integrateCostSensitivityDU0 (control_vector &dU0, const SCALAR startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity of the cost with respect to the initial control input u0. More...
 
void integrateCostSensitivityDUf (control_vector &dUf, const SCALAR &startTime, const size_t numSteps, const SCALAR dt)
 Integrates the sensitivity of the cost with respect to the final control input uF. More...
 
void linearize ()
 Linearizes the system around the rollout from the state interation. More...
 
void clearStates ()
 Clears the cached states, controls and times. More...
 
void clearSensitivities ()
 Clears the cached sensitivities. More...
 
void clearLinearization ()
 Clears the linearized matrices. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::StateVector< STATE_DIM, SCALARstate_vector
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
class ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >

This class can integrate a controlled system and a costfunction. Furthermore, it provides first order derivatives with respect to initial state and control.

Template Parameters
STATE_DIMThe state dimension
CONTROL_DIMThe control dimension
SCALARThe scalar type

Member Typedef Documentation

◆ control_vector

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef ct::core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector

◆ state_matrix

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, STATE_DIM, STATE_DIM> ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::state_matrix

◆ control_matrix

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, CONTROL_DIM, CONTROL_DIM> ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::control_matrix

◆ state_control_matrix

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Eigen::Matrix<SCALAR, STATE_DIM, CONTROL_DIM> ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::state_control_matrix

Constructor & Destructor Documentation

◆ SensitivityIntegratorCT()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::SensitivityIntegratorCT ( const std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  system,
const ct::core::IntegrationType  stepperType = ct::core::IntegrationType::EULERCT 
)
inline

◆ ~SensitivityIntegratorCT()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::~SensitivityIntegratorCT ( )
default

Member Function Documentation

◆ initializeDerived()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::initializeDerived ( const ct::core::IntegrationType  stepperType)
inline

Initializes the steppers.

Parameters
[in]stepperTypeThe desired integration stepper type

Referenced by ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::SensitivityIntegratorCT().

◆ setLinearSystem()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::setLinearSystem ( const std::shared_ptr< ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  linearSystem)
inline

Prepares the integrator to provide first order sensitivity generation by setting a linearsystem, enabling state caching and settings up the function objects.

Parameters
[in]linearSystemThe linearized system

References t.

◆ setControlledSystem()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::setControlledSystem ( const std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  controlledSystem)
inline

Changes the controlledsystem to be integrated.

Parameters
[in]controlledSystemThe new controlled system

References t, and x.

Referenced by ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::SensitivityIntegratorCT().

◆ setCostFunction()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::setCostFunction ( const std::shared_ptr< CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >>  costFun)
inline

Prepares the integrator to provide cost integration and first order cost derivatives. This is done by enabling sensitivity caching and setting up the function objects.

Parameters
[in]costFunThe new costfunction

References t.

◆ integrate() [1/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrate ( state_vector state,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt,
ct::core::StateVectorArray< STATE_DIM, SCALAR > &  stateTrajectory,
ct::core::tpl::TimeArray< SCALAR > &  timeTrajectory 
)
inline

Integrates the system starting from state and startTime for numSteps integration steps. Returns the full state and time trajectories.

Parameters
[in,out]stateThe initial state for integration
[in]startTimeThe start time
[in]numStepsThe number steps
[in]dtThe integration timestep
[out]stateTrajectoryThe output state trajectory
[out]timeTrajectoryThe output time trajectory

References ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearLinearization(), ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearStates(), dt, and i.

◆ integrate() [2/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrate ( state_vector state,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the system starting from state and startTime for numSteps integration steps. Returns only the final state and time.

Parameters

References ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearLinearization(), ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearStates(), dt, and i.

◆ integrateSensitivityDX0()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateSensitivityDX0 ( state_matrix dX0,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity ODE of the integrator with respec to the initial state x0.

Parameters
[in,out]dX0The sensitivity matrix wrt x0
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration timestep

References dt, and i.

◆ integrateSensitivityDU0()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateSensitivityDU0 ( state_control_matrix dU0,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity ODE of the integrator with respec to the initial control input u0.

Parameters
[in,out]dU0The sensitivity matrix wrt u0
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration timestep

References dt, and i.

◆ integrateSensitivityDUf()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateSensitivityDUf ( state_control_matrix dUf,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity ODE of the integrator with respec to the final control input uf.

Parameters
[in,out]dUFThe sensitivity matrix wrt uF
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration timestep

References dt, and i.

◆ integrateCost()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateCost ( SCALAR cost,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the costfunction using the states and controls from the costintegration.

Parameters
[in,out]costThe initial cost
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration time step

References dt, and i.

◆ integrateCostSensitivityDX0()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateCostSensitivityDX0 ( state_vector dX0,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity of the cost with respect to the initial state x0.

Parameters
[in,out]dX0The initial cost sensitivity vector
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration time step

References dt, and i.

◆ integrateCostSensitivityDU0()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateCostSensitivityDU0 ( control_vector dU0,
const SCALAR  startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity of the cost with respect to the initial control input u0.

Parameters
[in,out]dU0The initial cost sensitivity vector
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration time step

References dt, and i.

◆ integrateCostSensitivityDUf()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrateCostSensitivityDUf ( control_vector dUf,
const SCALAR startTime,
const size_t  numSteps,
const SCALAR  dt 
)
inline

Integrates the sensitivity of the cost with respect to the final control input uF.

Parameters
[in,out]dUfThe initial cost sensitivity vector
[in]startTimeThe start time
[in]numStepsThe number of integration steps
[in]dtThe integration time step

References dt, and i.

◆ linearize()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::linearize ( )
inline

Linearizes the system around the rollout from the state interation.

References i.

◆ clearStates()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearStates ( )
inline

Clears the cached states, controls and times.

Referenced by ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::integrate().

◆ clearSensitivities()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearSensitivities ( )
inline

Clears the cached sensitivities.

◆ clearLinearization()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
void ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::clearLinearization ( )
inline

Member Data Documentation

◆ state_vector

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::StateVector<STATE_DIM, SCALAR> ct::optcon::SensitivityIntegratorCT< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector

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