- 3.0.2 optimal control module.
ConstraintContainerAnalytical-impl.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 
11 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
13 {
14 }
15 
16 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
18  const input_vector_t& u,
19  const SCALAR& t)
20 {
21 }
22 
23 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
26  : LinearConstraintContainer<STATE_DIM, CONTROL_DIM, SCALAR>(arg),
27  constraintsIntermediate_(arg.constraintsIntermediate_),
28  constraintsTerminal_(arg.constraintsTerminal_),
29  evalIntermediate_(arg.evalIntermediate_),
30  evalJacSparseStateIntermediate_(arg.evalJacSparseStateIntermediate_),
31  evalJacSparseInputIntermediate_(arg.evalJacSparseInputIntermediate_),
32  evalJacDenseStateIntermediate_(arg.evalJacDenseStateIntermediate_),
33  evalJacDenseInputIntermediate_(arg.evalJacDenseInputIntermediate_),
34  evalTerminal_(arg.evalTerminal_),
35  evalJacSparseStateTerminal_(arg.evalJacSparseStateTerminal_),
36  evalJacSparseInputTerminal_(arg.evalJacSparseInputTerminal_),
37  evalJacDenseStateTerminal_(arg.evalJacDenseStateTerminal_),
38  evalJacDenseInputTerminal_(arg.evalJacDenseInputTerminal_)
39 {
40  // vectors of terms can be resized easily
41  constraintsIntermediate_.resize(arg.constraintsIntermediate_.size());
42  constraintsTerminal_.resize(arg.constraintsTerminal_.size());
43 
44  for (size_t i = 0; i < constraintsIntermediate_.size(); ++i)
45  constraintsIntermediate_[i] =
46  std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>>(arg.constraintsIntermediate_[i]->clone());
47 
48  for (size_t i = 0; i < constraintsTerminal_.size(); ++i)
49  constraintsTerminal_[i] =
50  std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>>(arg.constraintsTerminal_[i]->clone());
51 }
52 
53 
54 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
57 {
59 }
60 
61 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
63 {
64 }
65 
66 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
68  std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>> constraint,
69  bool verbose)
70 {
71  constraintsIntermediate_.push_back(constraint);
72  if (verbose)
73  {
74  std::string name;
75  constraint->getName(name);
76  std::cout << "''" << name << "'' added as Analytical intermediate constraint " << std::endl;
77  }
78  this->initializedIntermediate_ = false;
79 }
80 
81 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
83  std::shared_ptr<ConstraintBase<STATE_DIM, CONTROL_DIM, SCALAR>> constraint,
84  bool verbose)
85 {
86  constraintsTerminal_.push_back(constraint);
87  if (verbose)
88  {
89  std::string name;
90  constraint->getName(name);
91  std::cout << "''" << name << "'' added as Analytical terminal constraint " << std::endl;
92  }
93  this->initializedTerminal_ = false;
94 }
95 
96 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
99 {
100  checkIntermediateConstraints();
101 
102  size_t count = 0;
103  for (auto constraint : constraintsIntermediate_)
104  {
105  size_t constraint_dim = constraint->getConstraintSize();
106  evalIntermediate_.segment(count, constraint_dim) = constraint->evaluate(this->x_, this->u_, this->t_);
107  count += constraint_dim;
108  }
109  return evalIntermediate_;
110 }
111 
112 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
115 {
116  checkTerminalConstraints();
117 
118  size_t count = 0;
119  for (auto constraint : constraintsTerminal_)
120  {
121  size_t constraint_dim = constraint->getConstraintSize();
122  evalTerminal_.segment(count, constraint_dim) = constraint->evaluate(this->x_, this->u_, this->t_);
123  count += constraint_dim;
124  }
125  return evalTerminal_;
126 }
127 
128 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
130 {
131  size_t count = 0;
132 
133  for (auto constraint : constraintsIntermediate_)
134  count += constraint->getConstraintSize();
135 
136  return count;
137 }
138 
139 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
141 {
142  size_t count = 0;
143  for (auto constraint : constraintsTerminal_)
144  count += constraint->getConstraintSize();
145 
146  return count;
147 }
148 
149 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
152 {
153  checkIntermediateConstraints();
154 
155  size_t count = 0;
156  for (auto constraint : constraintsIntermediate_)
157  {
158  size_t nonZerosState = constraint->getNumNonZerosJacobianState();
159 
160  if (nonZerosState != 0)
161  {
162  evalJacSparseStateIntermediate_.segment(count, nonZerosState) =
163  constraint->jacobianStateSparse(this->x_, this->u_, this->t_);
164  count += nonZerosState;
165  }
166  }
167  return evalJacSparseStateIntermediate_;
168 }
169 
170 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
173 {
174  checkIntermediateConstraints();
175 
176  MatrixXs jacLocal;
177  size_t count = 0;
178  for (auto constraint : constraintsIntermediate_)
179  {
180  size_t constraint_dim = constraint->getConstraintSize();
181  evalJacDenseStateIntermediate_.block(count, 0, constraint_dim, STATE_DIM) =
182  constraint->jacobianState(this->x_, this->u_, this->t_);
183  count += constraint_dim;
184  }
185 
186  return evalJacDenseStateIntermediate_;
187 }
188 
189 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
192 {
193  checkIntermediateConstraints();
194 
195  size_t count = 0;
196  for (auto constraint : constraintsTerminal_)
197  {
198  size_t nonZerosState = constraint->getNumNonZerosJacobianState();
199 
200  if (nonZerosState != 0)
201  {
202  evalJacSparseStateTerminal_.segment(count, nonZerosState) =
203  constraint->jacobianStateSparse(this->x_, this->u_, this->t_);
204  count += nonZerosState;
205  }
206  }
207  return evalJacSparseStateTerminal_;
208 }
209 
210 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
213 {
214  checkIntermediateConstraints();
215 
216  size_t count = 0;
217  for (auto constraint : constraintsTerminal_)
218  {
219  size_t constraint_dim = constraint->getConstraintSize();
220  evalJacDenseStateTerminal_.block(count, 0, constraint_dim, STATE_DIM) =
221  constraint->jacobianState(this->x_, this->u_, this->t_);
222  count += constraint_dim;
223  }
224 
225  return evalJacDenseStateTerminal_;
226 }
227 
228 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
231 {
232  checkIntermediateConstraints();
233 
234  size_t count = 0;
235  for (auto constraint : constraintsIntermediate_)
236  {
237  size_t nonZerosInput = constraint->getNumNonZerosJacobianInput();
238 
239  if (nonZerosInput != 0)
240  {
241  evalJacSparseInputIntermediate_.segment(count, nonZerosInput) =
242  constraint->jacobianInputSparse(this->x_, this->u_, this->t_);
243  count += nonZerosInput;
244  }
245  }
246  return evalJacSparseInputIntermediate_;
247 }
248 
249 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
252 {
253  checkIntermediateConstraints();
254 
255  size_t count = 0;
256  for (auto constraint : constraintsIntermediate_)
257  {
258  size_t constraint_dim = constraint->getConstraintSize();
259  evalJacDenseInputIntermediate_.block(count, 0, constraint_dim, CONTROL_DIM) =
260  constraint->jacobianInput(this->x_, this->u_, this->t_);
261  count += constraint_dim;
262  }
263 
264  return evalJacDenseInputIntermediate_;
265 }
266 
267 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
270 {
271  checkTerminalConstraints();
272 
273  size_t count = 0;
274  for (auto constraint : constraintsTerminal_)
275  {
276  size_t nonZerosInput = constraint->getNumNonZerosJacobianInput();
277 
278  if (nonZerosInput != 0)
279  {
280  evalJacSparseInputTerminal_.segment(count, nonZerosInput) =
281  constraint->jacobianInputSparse(this->x_, this->u_, this->t_);
282  count += nonZerosInput;
283  }
284  }
285  return evalJacSparseInputTerminal_;
286 }
287 
288 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
291 {
292  checkTerminalConstraints();
293 
294  size_t count = 0;
295  for (auto constraint : constraintsTerminal_)
296  {
297  size_t constraint_dim = constraint->getConstraintSize();
298  evalJacDenseInputTerminal_.block(count, 0, constraint_dim, CONTROL_DIM) =
299  constraint->jacobianInput(this->x_, this->u_, this->t_);
300  count += constraint_dim;
301  }
302 
303  return evalJacDenseInputTerminal_;
304 }
305 
306 
307 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
309  Eigen::VectorXi& iRows,
310  Eigen::VectorXi& jCols)
311 {
312  checkIntermediateConstraints();
313 
314  Eigen::VectorXi iRowLocal;
315  Eigen::VectorXi jColLocal;
316  Eigen::VectorXi iRowTot;
317  Eigen::VectorXi jColTot;
318 
319  size_t count = 0;
320  size_t constraintCount = 0;
321 
322  for (auto constraint : constraintsIntermediate_)
323  {
324  size_t nonZerosState = constraint->getNumNonZerosJacobianState();
325  if (nonZerosState > 0)
326  {
327  constraint->sparsityPatternState(iRowLocal, jColLocal);
328 
329  iRowTot.conservativeResize(count + nonZerosState);
330  iRowTot.segment(count, nonZerosState) = iRowLocal.array() + constraintCount;
331 
332  jColTot.conservativeResize(count + nonZerosState);
333  jColTot.segment(count, nonZerosState) = jColLocal;
334 
335  count += nonZerosState;
336  }
337  constraintCount += constraint->getConstraintSize();
338  }
339 
340  iRows = iRowTot;
341  jCols = jColTot;
342 }
343 
344 
345 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
347  Eigen::VectorXi& jCols)
348 {
349  if (!this->initializedTerminal_)
350  throw std::runtime_error(
351  "sparsityPatternStateTerminalConstraints not initialized yet. Call 'initialize()' before");
352 
353  Eigen::VectorXi iRowLocal;
354  Eigen::VectorXi jColLocal;
355  Eigen::VectorXi iRowTot;
356  Eigen::VectorXi jColTot;
357 
358  size_t count = 0;
359  size_t constraintCount = 0;
360 
361  for (auto constraint : constraintsTerminal_)
362  {
363  size_t nonZerosState = constraint->getNumNonZerosJacobianState();
364  if (nonZerosState > 0)
365  {
366  constraint->sparsityPatternState(iRowLocal, jColLocal);
367 
368  iRowTot.conservativeResize(count + nonZerosState);
369  iRowTot.segment(count, nonZerosState) = iRowLocal.array() + constraintCount;
370 
371  jColTot.conservativeResize(count + nonZerosState);
372  jColTot.segment(count, nonZerosState) = jColLocal;
373 
374  count += nonZerosState;
375  }
376  constraintCount += constraint->getConstraintSize();
377  }
378 
379  iRows = iRowTot;
380  jCols = jColTot;
381 }
382 
383 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
385  Eigen::VectorXi& iRows,
386  Eigen::VectorXi& jCols)
387 {
388  checkIntermediateConstraints();
389 
390  Eigen::VectorXi iRowLocal;
391  Eigen::VectorXi jColLocal;
392  Eigen::VectorXi iRowTot;
393  Eigen::VectorXi jColTot;
394 
395  size_t count = 0;
396  size_t constraintCount = 0;
397 
398  for (auto constraint : constraintsIntermediate_)
399  {
400  size_t nonZerosInput = constraint->getNumNonZerosJacobianInput();
401  if (nonZerosInput > 0)
402  {
403  constraint->sparsityPatternInput(iRowLocal, jColLocal);
404 
405  iRowTot.conservativeResize(count + nonZerosInput);
406  iRowTot.segment(count, nonZerosInput) = iRowLocal.array() + constraintCount;
407 
408  jColTot.conservativeResize(count + nonZerosInput);
409  jColTot.segment(count, nonZerosInput) = jColLocal;
410 
411  count += nonZerosInput;
412  }
413  constraintCount += constraint->getConstraintSize();
414  }
415 
416  iRows = iRowTot;
417  jCols = jColTot;
418 }
419 
420 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
422  Eigen::VectorXi& jCols)
423 {
424  if (!this->initializedTerminal_)
425  throw std::runtime_error(
426  "sparsityPatternInputTerminalConstraints not initialized yet. Call 'initialize()' before");
427 
428  Eigen::VectorXi iRowLocal;
429  Eigen::VectorXi jColLocal;
430  Eigen::VectorXi iRowTot;
431  Eigen::VectorXi jColTot;
432 
433  size_t count = 0;
434  size_t constraintCount = 0;
435 
436  for (auto constraint : constraintsTerminal_)
437  {
438  size_t nonZerosInput = constraint->getNumNonZerosJacobianInput();
439  if (nonZerosInput > 0)
440  {
441  constraint->sparsityPatternInput(iRowLocal, jColLocal);
442 
443  iRowTot.conservativeResize(count + nonZerosInput);
444  iRowTot.segment(count, nonZerosInput) = iRowLocal.array() + constraintCount;
445 
446  jColTot.conservativeResize(count + nonZerosInput);
447  jColTot.segment(count, nonZerosInput) = jColLocal;
448 
449  count += nonZerosInput;
450  }
451  constraintCount += constraint->getConstraintSize();
452  }
453 
454  iRows = iRowTot;
455  jCols = jColTot;
456 }
457 
458 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
460 {
461  size_t count = 0;
462  for (auto constraint : constraintsIntermediate_)
463  count += constraint->getNumNonZerosJacobianState();
464 
465  return count;
466 }
467 
468 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
470 {
471  size_t count = 0;
472  for (auto constraint : constraintsTerminal_)
473  count += constraint->getNumNonZerosJacobianState();
474 
475  return count;
476 }
477 
478 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
480 {
481  size_t count = 0;
482  for (auto constraint : constraintsIntermediate_)
483  count += constraint->getNumNonZerosJacobianInput();
484 
485  return count;
486 }
487 
488 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
490 {
491  size_t count = 0;
492  for (auto constraint : constraintsTerminal_)
493  count += constraint->getNumNonZerosJacobianInput();
494 
495  return count;
496 }
497 
498 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
500 {
502  {
503  evalIntermediate_.resize(getIntermediateConstraintsCount());
504  evalIntermediate_.setZero();
505  evalJacSparseStateIntermediate_.resize(getJacobianStateNonZeroCountIntermediate());
506  evalJacSparseStateIntermediate_.setZero();
507  evalJacSparseInputIntermediate_.resize(getJacobianInputNonZeroCountIntermediate());
508  evalJacSparseInputIntermediate_.setZero();
509  evalJacDenseStateIntermediate_.resize(getIntermediateConstraintsCount(), STATE_DIM);
510  evalJacDenseStateIntermediate_.setZero();
511  evalJacDenseInputIntermediate_.resize(getIntermediateConstraintsCount(), CONTROL_DIM);
512  evalJacDenseInputIntermediate_.setZero();
513 
514  size_t count = 0;
515 
517  this->lowerBoundsIntermediate_.setZero();
519  this->upperBoundsIntermediate_.setZero();
520 
521  for (auto constraint : constraintsIntermediate_)
522  {
523  size_t constraintSize = constraint->getConstraintSize();
524  this->lowerBoundsIntermediate_.segment(count, constraintSize) = constraint->getLowerBound();
525  this->upperBoundsIntermediate_.segment(count, constraintSize) = constraint->getUpperBound();
526  count += constraintSize;
527  }
528  }
529 
530  return true;
531 }
532 
533 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
535 {
536  if (getTerminalConstraintsCount() > 0)
537  {
538  evalTerminal_.resize(getTerminalConstraintsCount());
539  evalTerminal_.setZero();
540  evalJacSparseStateTerminal_.resize(getJacobianStateNonZeroCountTerminal());
541  evalJacSparseStateTerminal_.setZero();
542  evalJacSparseInputTerminal_.resize(getJacobianInputNonZeroCountTerminal());
543  evalJacSparseInputTerminal_.setZero();
544  evalJacDenseStateTerminal_.resize(getTerminalConstraintsCount(), STATE_DIM);
545  evalJacDenseStateTerminal_.setZero();
546  evalJacDenseInputTerminal_.resize(getTerminalConstraintsCount(), CONTROL_DIM);
547  evalJacDenseInputTerminal_.setZero();
548 
549  size_t count = 0;
550 
552  this->lowerBoundsTerminal_.setZero();
554  this->upperBoundsTerminal_.setZero();
555 
556  for (auto constraint : constraintsTerminal_)
557  {
558  size_t constraintSize = constraint->getConstraintSize();
559  this->lowerBoundsTerminal_.segment(count, constraintSize) = constraint->getLowerBound();
560  this->upperBoundsTerminal_.segment(count, constraintSize) = constraint->getUpperBound();
561  count += constraintSize;
562  }
563  }
564 
565  return true;
566 }
567 
568 
569 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
571 {
572 }
573 
574 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
576 {
577  if (!this->initializedIntermediate_)
578  throw std::runtime_error("Error: Intermediate constraints are or not initialized yet. ");
579 }
580 
581 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
583 {
584  if (!this->initializedTerminal_)
585  throw std::runtime_error("Error: Terminal constraints are either not initialized yet. ");
586 }
587 
588 } // namespace optcon
589 } // namespace ct
virtual void sparsityPatternInputTerminal(Eigen::VectorXi &iRows, Eigen::VectorXi &jCols) override
Returns the sparsity pattern for the jacobian wrt control.
Definition: ConstraintContainerAnalytical-impl.h:421
virtual ConstraintContainerAnalytical_Raw_Ptr_t clone() const override
Deep-cloning of Constraint.
Definition: ConstraintContainerAnalytical-impl.h:56
virtual MatrixXs jacobianStateIntermediate() override
Evaluates the constraint jacobian wrt the state.
Definition: ConstraintContainerAnalytical-impl.h:172
virtual size_t getJacobianInputNonZeroCountIntermediate() override
Returns the number of non zero elements in the constraint jacobian wrt input.
Definition: ConstraintContainerAnalytical-impl.h:479
virtual VectorXs jacobianStateSparseTerminal() override
Evaluates the constraint jacobian wrt the state using sparse representation.
Definition: ConstraintContainerAnalytical-impl.h:191
virtual void sparsityPatternStateTerminal(Eigen::VectorXi &iRows, Eigen::VectorXi &jCols) override
Returns the sparsity pattern for the jacobian wrt state.
Definition: ConstraintContainerAnalytical-impl.h:346
A base function for linear constraint functions which have a first derivative.
Definition: LinearConstraintContainer.h:27
input_vector_t u_
Definition: ConstraintContainerBase.h:198
void addTerminalConstraint(std::shared_ptr< ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >> constraint, bool verbose)
Adds a terminal constraint.
Definition: ConstraintContainerAnalytical-impl.h:82
virtual size_t getJacobianInputNonZeroCountTerminal() override
Returns the number of non zero elements in the constraint jacobian wrt input.
Definition: ConstraintContainerAnalytical-impl.h:489
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
virtual bool initializeTerminal() override
Initializes the terminal constraints.
Definition: ConstraintContainerAnalytical-impl.h:534
bool initializedIntermediate_
Definition: LinearConstraintContainer.h:238
virtual MatrixXs jacobianStateTerminal() override
Evaluates the constraint jacobian wrt the state.
Definition: ConstraintContainerAnalytical-impl.h:212
virtual VectorXs jacobianInputSparseIntermediate() override
Evaluates the constraint jacobian wrt the control input using sparse representation.
Definition: ConstraintContainerAnalytical-impl.h:230
VectorXs lowerBoundsTerminal_
Definition: ConstraintContainerBase.h:202
virtual size_t getIntermediateConstraintsCount() override
Retrieves the number of intermediate constraints.
Definition: ConstraintContainerAnalytical-impl.h:129
virtual size_t getTerminalConstraintsCount() override
Retrieves the number of final constraints.
Definition: ConstraintContainerAnalytical-impl.h:140
virtual VectorXs evaluateTerminal() override
Evaluates the terminal constraints.
Definition: ConstraintContainerAnalytical-impl.h:114
virtual VectorXs jacobianStateSparseIntermediate() override
Evaluates the constraint jacobian wrt the state using sparse representation.
Definition: ConstraintContainerAnalytical-impl.h:151
virtual void sparsityPatternInputIntermediate(Eigen::VectorXi &iRows, Eigen::VectorXi &jCols) override
Returns the sparsity pattern for the jacobian wrt control.
Definition: ConstraintContainerAnalytical-impl.h:384
void addIntermediateConstraint(std::shared_ptr< ConstraintBase< STATE_DIM, CONTROL_DIM, SCALAR >> constraint, bool verbose)
Adds an intermedaite constraint.
Definition: ConstraintContainerAnalytical-impl.h:67
VectorXs upperBoundsTerminal_
Definition: ConstraintContainerBase.h:204
virtual VectorXs evaluateIntermediate() override
Evaluates the intermediate constraints.
Definition: ConstraintContainerAnalytical-impl.h:98
VectorXs lowerBoundsIntermediate_
Definition: ConstraintContainerBase.h:201
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
virtual void sparsityPatternStateIntermediate(Eigen::VectorXi &iRows, Eigen::VectorXi &jCols) override
Returns the sparsity pattern for the jacobian wrt state.
Definition: ConstraintContainerAnalytical-impl.h:308
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
Definition: ConstraintContainerAnalytical.h:36
CppAD::AD< CppAD::cg::CG< double > > SCALAR
bool initializedTerminal_
Definition: LinearConstraintContainer.h:239
virtual VectorXs jacobianInputSparseTerminal() override
Evaluates the constraint jacobian wrt the control input using sparse representation.
Definition: ConstraintContainerAnalytical-impl.h:269
virtual size_t getJacobianStateNonZeroCountIntermediate() override
Returns the number of non zero elements in the constraint jacobian wrt state.
Definition: ConstraintContainerAnalytical-impl.h:459
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > MatrixXs
Definition: ConstraintContainerAnalytical.h:37
ConstraintContainerAnalytical()
Definition: ConstraintContainerAnalytical-impl.h:12
for i
Definition: mpc_unittest_plotting.m:14
SCALAR t_
Definition: ConstraintContainerBase.h:199
Contains all the constraints using analytically calculated jacobians.
Definition: ConstraintContainerAnalytical.h:27
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
virtual MatrixXs jacobianInputIntermediate() override
Evaluates the constraint jacobian wrt the control input.
Definition: ConstraintContainerAnalytical-impl.h:251
virtual bool initializeIntermediate() override
Initializes the intermediate constraints.
Definition: ConstraintContainerAnalytical-impl.h:499
VectorXs upperBoundsIntermediate_
Definition: ConstraintContainerBase.h:203
state_vector_t x_
Definition: ConstraintContainerBase.h:197
virtual size_t getJacobianStateNonZeroCountTerminal() override
Returns the number of non zero elements in the constraint jacobian wrt state.
Definition: ConstraintContainerAnalytical-impl.h:469
virtual ~ConstraintContainerAnalytical()
Destructor.
Definition: ConstraintContainerAnalytical-impl.h:62
virtual MatrixXs jacobianInputTerminal() override
Evaluates the constraint jacobian wrt the control input.
Definition: ConstraintContainerAnalytical-impl.h:290
Eigen::Matrix< double, nStates, 1 > state_vector_t
const bool verbose
Definition: ConstraintComparison.h:18
Base class for the constraints used in this toolbox.
Definition: ConstraintBase.h:21