- 3.0.2 optimal control module.
ConstraintContainerBase.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 namespace ct {
9 namespace optcon {
10 
30 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
32 {
33 public:
34  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35 
38 
40  typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> VectorXs;
41 
48 
55 
61  virtual ~ConstraintContainerBase();
62 
67  virtual ConstraintBase_Raw_Ptr_t clone() const = 0;
68 
78  virtual void setCurrentStateAndControl(const state_vector_t& x,
79  const input_vector_t& u,
80  const SCALAR t = SCALAR(0.0));
81 
87  virtual VectorXs evaluateIntermediate() = 0;
88 
94  virtual VectorXs evaluateTerminal() = 0;
95 
101  virtual size_t getIntermediateConstraintsCount() = 0;
102 
108  virtual size_t getTerminalConstraintsCount() = 0;
109 
115  size_t getConstraintsCount();
122  VectorXs getLowerBoundsIntermediate() const;
123 
130  VectorXs getLowerBoundsTerminal() const;
131 
138  VectorXs getUpperBoundsIntermediate() const;
139 
146  VectorXs getUpperBoundsTerminal() const;
147 
154 
161 
168 
175 
182 
189 
190 protected:
195  virtual void update() = 0;
196 
197  state_vector_t x_;
198  input_vector_t u_;
205 };
206 
207 
208 } // namespace optcon
209 } // namespace ct
VectorXs getLowerBoundsIntermediate() const
Retrieves the lower constraint bound on the intermediate constraints.
Definition: ConstraintContainerBase-impl.h:53
VectorXs getLowerBoundsTerminal() const
Retrieves the lower constraint bound on the terminal constraints.
Definition: ConstraintContainerBase-impl.h:60
virtual void setCurrentStateAndControl(const state_vector_t &x, const input_vector_t &u, const SCALAR t=SCALAR(0.0))
Definition: ConstraintContainerBase-impl.h:35
input_vector_t u_
Definition: ConstraintContainerBase.h:198
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
Definition: ConstraintContainerBase.h:40
VectorXs getUpperBoundsTerminal() const
Retrieves the upper constraint bound on the terminal constraints.
Definition: ConstraintContainerBase-impl.h:74
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
core::ControlVector< CONTROL_DIM, SCALAR > input_vector_t
Definition: ConstraintContainerBase.h:37
VectorXs lowerBoundsTerminal_
Definition: ConstraintContainerBase.h:202
virtual size_t getIntermediateConstraintsCount()=0
Retrieves the number of intermediate constraints.
VectorXs getUpperBoundsViolationIntermediate()
Retrieves the violation of the upper constraint bound on the intermediate constraints.
Definition: ConstraintContainerBase-impl.h:81
VectorXs upperBoundsTerminal_
Definition: ConstraintContainerBase.h:204
VectorXs lowerBoundsIntermediate_
Definition: ConstraintContainerBase.h:201
VectorXs getTotalBoundsViolationIntermediate()
Retrieves the total violation of the constraints bounds on the intermediate constraints.
Definition: ConstraintContainerBase-impl.h:113
virtual VectorXs evaluateIntermediate()=0
Evaluates the intermediate constraints.
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
virtual ~ConstraintContainerBase()
Destructor.
Definition: ConstraintContainerBase-impl.h:30
virtual size_t getTerminalConstraintsCount()=0
Retrieves the number of final constraints.
VectorXs getUpperBoundsIntermediate() const
Retrieves the upper constraint bound on the intermediate constraints.
Definition: ConstraintContainerBase-impl.h:67
CppAD::AD< CppAD::cg::CG< double > > SCALAR
VectorXs getTotalBoundsViolationTerminal()
Retrieves the total violation of the constraints bounds on the terminal constraints.
Definition: ConstraintContainerBase-impl.h:123
virtual void update()=0
Gets called by the setCurrentStateAndControl method. Can be used to update container properties...
virtual VectorXs evaluateTerminal()=0
Evaluates the terminal constraints.
VectorXs getUpperBoundsViolationTerminal()
Retrieves the violation of the upper constraint bound on the terminal constraints.
Definition: ConstraintContainerBase-impl.h:97
size_t getConstraintsCount()
Retrieves the total number of constraints.
Definition: ConstraintContainerBase-impl.h:46
SCALAR t_
Definition: ConstraintContainerBase.h:199
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
VectorXs upperBoundsIntermediate_
Definition: ConstraintContainerBase.h:203
VectorXs getLowerBoundsViolationTerminal()
Retrieves the violation of the lower constraint bound on the terminal constraints.
Definition: ConstraintContainerBase-impl.h:105
The ConstraintBase Class is the base class for defining the non-linear optimization constraints...
Definition: ConstraintContainerBase.h:31
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef core::StateVector< STATE_DIM, SCALAR > state_vector_t
Definition: ConstraintContainerBase.h:36
state_vector_t x_
Definition: ConstraintContainerBase.h:197
virtual ConstraintBase_Raw_Ptr_t clone() const =0
VectorXs getLowerBoundsViolationIntermediate()
Retrieves the violation of the lower constraint bound on the intermediate constraints.
Definition: ConstraintContainerBase-impl.h:89
ConstraintContainerBase()
Default constructor.
Definition: ConstraintContainerBase-impl.h:12
ConstraintContainerBase< STATE_DIM, CONTROL_DIM, SCALAR > * ConstraintBase_Raw_Ptr_t
Definition: ConstraintContainerBase.h:39