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

#include <ADTest_timeDependent.h>

Inheritance diagram for ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >:
ct::optcon::TermBase< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >

Public Types

typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_t
 
typedef Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_double_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_double_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_double_t
 
- Public Types inherited from ct::optcon::TermBase< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >
typedef Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_t
 
typedef Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_double_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_double_t
 
typedef Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_double_t
 

Public Member Functions

 TestTerm ()
 
 TestTerm (const state_matrix_t &Q, const control_matrix_t &R, const SCALAR_EVAL &c)
 
 TestTerm (const TestTerm &arg)
 
virtual ~TestTerm ()
 
TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR > * clone () const override
 Deep-copy term. More...
 
void setWeights (const state_matrix_t &Q, const control_matrix_t &R, const double &c)
 
void setStateAndControlReference (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x_ref, core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u_ref)
 
virtual SCALAR evaluate (const Eigen::Matrix< SCALAR, STATE_DIM, 1 > &x, const Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &u, const SCALAR &t) override
 Evaluates the term at x, u, t. More...
 
virtual ct::core::ADCGScalar evaluateCppadCg (const core::StateVector< STATE_DIM, ct::core::ADCGScalar > &x, const core::ControlVector< CONTROL_DIM, ct::core::ADCGScalar > &u, ct::core::ADCGScalar t) override
 
core::StateVector< STATE_DIM, SCALAR_EVAL > stateDerivativeAnalytical (const core::StateVector< STATE_DIM > &x, const core::ControlVector< CONTROL_DIM > &u, const double t)
 
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > controlDerivativeAnalytical (const core::StateVector< STATE_DIM > &x, const core::ControlVector< CONTROL_DIM > &u, double t)
 
state_matrix_t stateSecondDerivativeAnalytical (const core::StateVector< STATE_DIM > &x, const core::ControlVector< CONTROL_DIM > &u, const double t)
 
control_matrix_t controlSecondDerivativeAnalytical (const core::StateVector< STATE_DIM > &x, const core::ControlVector< CONTROL_DIM > &u, double t)
 
- Public Member Functions inherited from ct::optcon::TermBase< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >
 TermBase (std::string name="Unnamed")
 Default constructor. More...
 
 TermBase (const TermBase &arg)
 Copy Cunstructor. More...
 
virtual ~TermBase ()
 Destructor. More...
 
SCALAR_EVAL eval (const Eigen::Matrix< SCALAR_EVAL, STATE_DIM, 1 > &x, const Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, 1 > &u, const SCALAR_EVAL &t)
 Gets called by the analytical costfunction. Adds time dependent activations on top of the term. More...
 
virtual bool isActiveAtTime (SCALAR_EVAL t)
 Returns if term is non-zero at a specific time By default, all terms are evaluated at all times. However, if a term is not active at a certain time, you can overload this function to spare evaluations of the term and its derivatives. More...
 
SCALAR_EVAL computeActivation (SCALAR_EVAL t)
 compute time activation More...
 
virtual core::StateVector< STATE_DIM, SCALAR_EVAL > stateDerivative (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t)
 compute derivative of this cost term w.r.t. the state More...
 
virtual state_matrix_t stateSecondDerivative (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t)
 compute second order derivative of this cost term w.r.t. the state More...
 
virtual core::ControlVector< CONTROL_DIM, SCALAR_EVAL > controlDerivative (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t)
 compute derivative of this cost term w.r.t. the control input More...
 
virtual control_matrix_t controlSecondDerivative (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t)
 compute second order derivative of this cost term w.r.t. the control input More...
 
virtual control_state_matrix_t stateControlDerivative (const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t)
 compute the cross-term derivative (state-control) of this cost function term More...
 
virtual void loadConfigFile (const std::string &filename, const std::string &termName, bool verbose=false)
 load this term from a configuration file More...
 
void setTimeActivation (std::shared_ptr< ct::core::tpl::ActivationBase< SCALAR_EVAL >> c_i, bool verbose=false)
 set the time activation functions for this term More...
 
void loadTimeActivation (const std::string &filename, const std::string &termName, bool verbose=false)
 load the time activation functions for this term from file More...
 
const std::string & getName () const
 Returns the name of the term. More...
 
void setName (const std::string &termName)
 Sets the name of the term. More...
 
virtual void updateReferenceState (const Eigen::Matrix< SCALAR_EVAL, STATE_DIM, 1 > &newRefState)
 updates the reference state for this term More...
 
virtual void updateReferenceControl (const Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, 1 > &newRefControl)
 updates the reference control for this term More...
 
virtual Eigen::Matrix< SCALAR_EVAL, STATE_DIM, 1 > getReferenceState () const
 retrieve this term's current reference state More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_t
 

Protected Member Functions

template<typename SC >
SC evalLocal (const Eigen::Matrix< SC, STATE_DIM, 1 > &x, const Eigen::Matrix< SC, CONTROL_DIM, 1 > &u, const SC &t)
 

Protected Attributes

state_matrix_t Q_
 
control_matrix_t R_
 
SCALAR_EVAL c_
 
core::StateVector< STATE_DIM, SCALAR_EVAL > x_ref_
 
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > u_ref_
 
- Protected Attributes inherited from ct::optcon::TermBase< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >
std::string name_
 a name identifier for this term More...
 
std::shared_ptr< ct::core::tpl::ActivationBase< SCALAR_EVAL > > c_i_
 time activations for this term More...
 

Member Typedef Documentation

◆ control_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
typedef Eigen::Matrix<SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::control_matrix_t

◆ control_state_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
typedef Eigen::Matrix<SCALAR_EVAL, CONTROL_DIM, STATE_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::control_state_matrix_t

◆ state_matrix_double_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
typedef Eigen::Matrix<SCALAR_EVAL, STATE_DIM, STATE_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::state_matrix_double_t

◆ control_matrix_double_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
typedef Eigen::Matrix<SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::control_matrix_double_t

◆ control_state_matrix_double_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
typedef Eigen::Matrix<SCALAR_EVAL, CONTROL_DIM, STATE_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::control_state_matrix_double_t

Constructor & Destructor Documentation

◆ TestTerm() [1/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::TestTerm ( )

◆ TestTerm() [2/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::TestTerm ( const state_matrix_t Q,
const control_matrix_t R,
const SCALAR_EVAL &  c 
)
inline

◆ TestTerm() [3/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::TestTerm ( const TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR > &  arg)
inline

◆ ~TestTerm()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
virtual ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::~TestTerm ( )
inlinevirtual

Member Function Documentation

◆ clone()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
TestTerm<STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR>* ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::clone ( ) const
inlineoverridevirtual

◆ setWeights()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
void ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::setWeights ( const state_matrix_t Q,
const control_matrix_t R,
const double &  c 
)
inline

◆ setStateAndControlReference()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
void ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::setStateAndControlReference ( const core::StateVector< STATE_DIM, SCALAR_EVAL > &  x_ref,
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &  u_ref 
)
inline

◆ evaluate()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
virtual SCALAR ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::evaluate ( const Eigen::Matrix< SCALAR, STATE_DIM, 1 > &  x,
const Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &  u,
const SCALAR t 
)
inlineoverridevirtual

Evaluates the term at x, u, t.

Parameters
[in]xThe current state
[in]uThe current control
[in]tThe current time
Returns
The evaluatated cost term

Implements ct::optcon::TermBase< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >.

References t, u, and x.

◆ evaluateCppadCg()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
virtual ct::core::ADCGScalar ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::evaluateCppadCg ( const core::StateVector< STATE_DIM, ct::core::ADCGScalar > &  x,
const core::ControlVector< CONTROL_DIM, ct::core::ADCGScalar > &  u,
ct::core::ADCGScalar  t 
)
inlineoverridevirtual

References t, u, and x.

◆ stateDerivativeAnalytical()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
core::StateVector<STATE_DIM, SCALAR_EVAL> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::stateDerivativeAnalytical ( const core::StateVector< STATE_DIM > &  x,
const core::ControlVector< CONTROL_DIM > &  u,
const double  t 
)
inline

◆ controlDerivativeAnalytical()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
core::ControlVector<CONTROL_DIM, SCALAR_EVAL> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::controlDerivativeAnalytical ( const core::StateVector< STATE_DIM > &  x,
const core::ControlVector< CONTROL_DIM > &  u,
double  t 
)
inline

◆ stateSecondDerivativeAnalytical()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
state_matrix_t ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::stateSecondDerivativeAnalytical ( const core::StateVector< STATE_DIM > &  x,
const core::ControlVector< CONTROL_DIM > &  u,
const double  t 
)
inline

◆ controlSecondDerivativeAnalytical()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
control_matrix_t ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::controlSecondDerivativeAnalytical ( const core::StateVector< STATE_DIM > &  x,
const core::ControlVector< CONTROL_DIM > &  u,
double  t 
)
inline

◆ evalLocal()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
template<typename SC >
SC ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::evalLocal ( const Eigen::Matrix< SC, STATE_DIM, 1 > &  x,
const Eigen::Matrix< SC, CONTROL_DIM, 1 > &  u,
const SC &  t 
)
inlineprotected

Member Data Documentation

◆ state_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR_EVAL = double, typename SCALAR = SCALAR_EVAL>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix<SCALAR_EVAL, STATE_DIM, STATE_DIM> ct::optcon::example::TestTerm< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR >::state_matrix_t

◆ Q_

◆ R_

◆ c_

◆ x_ref_

◆ u_ref_


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