24 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR =
double>
25 class ConstraintContainerAD :
public LinearConstraintContainer<STATE_DIM, CONTROL_DIM, SCALAR>
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 typedef core::DerivativesCppadJIT<STATE_DIM + CONTROL_DIM, -1>
JacCG;
31 typedef typename JacCG::CG_SCALAR CGScalar;
34 typedef core::ControlVector<CONTROL_DIM, SCALAR> input_vector_t;
36 typedef ConstraintContainerAD<STATE_DIM, CONTROL_DIM, SCALAR>* ConstraintContainerAD_Raw_Ptr_t;
37 typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> VectorXs;
38 typedef Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> MatrixXs;
44 ConstraintContainerAD();
52 ConstraintContainerAD(
const state_vector_t&
x,
const input_vector_t&
u,
const SCALAR&
t = 0.0);
59 ConstraintContainerAD(
const ConstraintContainerAD& arg);
66 virtual ConstraintContainerAD_Raw_Ptr_t clone()
const override;
71 virtual ~ConstraintContainerAD();
79 void addIntermediateConstraint(std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>> constraint,
88 void addTerminalConstraint(std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>> constraint,
91 virtual VectorXs evaluateIntermediate()
override;
93 virtual VectorXs evaluateTerminal()
override;
95 virtual size_t getIntermediateConstraintsCount()
override;
97 virtual size_t getTerminalConstraintsCount()
override;
99 virtual VectorXs jacobianStateSparseIntermediate()
override;
101 virtual MatrixXs jacobianStateIntermediate()
override;
103 virtual VectorXs jacobianStateSparseTerminal()
override;
105 virtual MatrixXs jacobianStateTerminal()
override;
107 virtual VectorXs jacobianInputSparseIntermediate()
override;
109 virtual MatrixXs jacobianInputIntermediate()
override;
111 virtual VectorXs jacobianInputSparseTerminal()
override;
113 virtual MatrixXs jacobianInputTerminal()
override;
115 virtual void sparsityPatternStateIntermediate(Eigen::VectorXi& iRows, Eigen::VectorXi& jCols)
override;
117 virtual void sparsityPatternStateTerminal(Eigen::VectorXi& iRows, Eigen::VectorXi& jCols)
override;
119 virtual void sparsityPatternInputIntermediate(Eigen::VectorXi& iRows, Eigen::VectorXi& jCols)
override;
121 virtual void sparsityPatternInputTerminal(Eigen::VectorXi& iRows, Eigen::VectorXi& jCols)
override;
123 virtual size_t getJacobianStateNonZeroCountIntermediate()
override;
125 virtual size_t getJacobianStateNonZeroCountTerminal()
override;
127 virtual size_t getJacobianInputNonZeroCountIntermediate()
override;
129 virtual size_t getJacobianInputNonZeroCountTerminal()
override;
131 virtual bool initializeIntermediate()
override;
133 virtual bool initializeTerminal()
override;
137 virtual void update()
override;
147 Eigen::Matrix<CGScalar, Eigen::Dynamic, 1> evaluateIntermediateCodegen(
148 const Eigen::Matrix<CGScalar, STATE_DIM + CONTROL_DIM, 1>& stateinput);
158 Eigen::Matrix<CGScalar, Eigen::Dynamic, 1> evaluateTerminalCodegen(
159 const Eigen::Matrix<CGScalar, STATE_DIM + CONTROL_DIM, 1>& stateinput);
162 std::vector<std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>>> constraintsIntermediate_;
163 std::vector<std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>>> constraintsTerminal_;
165 std::shared_ptr<JacCG> intermediateCodegen_;
166 std::shared_ptr<JacCG> terminalCodegen_;
168 typename JacCG::FUN_TYPE_CG fIntermediate_;
169 typename JacCG::FUN_TYPE_CG fTerminal_;
171 Eigen::VectorXi sparsityIntermediateRows_;
172 Eigen::VectorXi sparsityStateIntermediateRows_;
173 Eigen::VectorXi sparsityStateIntermediateCols_;
174 Eigen::VectorXi sparsityInputIntermediateRows_;
175 Eigen::VectorXi sparsityInputIntermediateCols_;
177 Eigen::VectorXi sparsityTerminalRows_;
178 Eigen::VectorXi sparsityStateTerminalRows_;
179 Eigen::VectorXi sparsityStateTerminalCols_;
180 Eigen::VectorXi sparsityInputTerminalRows_;
181 Eigen::VectorXi sparsityInputTerminalCols_;
184 Eigen::Matrix<SCALAR, STATE_DIM + CONTROL_DIM, 1> stateControlD_;
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
CppAD::AD< CppAD::cg::CG< double > > SCALAR
ct::core::DerivativesCppadCG< state_dim, control_dim > JacCG
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
Eigen::Matrix< double, nStates, 1 > state_vector_t
const bool verbose
Definition: ConstraintComparison.h:18