20 template <
typename SCALAR>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
25 using VectorXs = Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>;
26 using VectorXi = Eigen::Matrix<int, Eigen::Dynamic, 1>;
46 xLb_.setConstant(std::numeric_limits<SCALAR>::lowest());
47 xUb_.setConstant(std::numeric_limits<SCALAR>::max());
127 bool xDim =
x_.size() == n ? true :
false;
128 bool xLDim =
xLb_.size() == n ? true :
false;
129 bool xUDim =
xUb_.size() == n ? true :
false;
130 return xDim && xLDim && xUDim;
168 assert(n ==
xMul_.size());
184 assert(m ==
zMul_.size());
195 size_t size()
const {
return x_.size(); }
205 assert(n == static_cast<size_t>(
zLow_.size()));
218 assert(m == static_cast<size_t>(
lambda_.size()));
230 assert(n ==
x_.size());
237 assert(n == static_cast<size_t>(
xInit_.size()));
VectorXs zLow_
Definition: OptVector.h:316
size_t updateCount_
Definition: OptVector.h:325
VectorXs xInit_
Definition: OptVector.h:311
VectorXs xUb_
Definition: OptVector.h:313
void getOptimizationVars(size_t n, MapVecXs &x) const
Gets the optimization variables.
Definition: OptVector.h:228
void getUpperBounds(MapVecXs &x) const
Gets the upper bounds of the optimization variables.
Definition: OptVector.h:157
void setZero()
Resets the optimization variables.
Definition: OptVector.h:97
bool checkOptimizationVarDimension(const unsigned int n)
Checks if the optimization variables have to correct size.
Definition: OptVector.h:125
void getConstraintsMultState(const size_t m, MapVecXs &zMul, MapVecXi &zState) const
Gets the constraint multiplier and state, used in the NLP solver SNOPT.
Definition: OptVector.h:182
VectorXs lambda_
Definition: OptVector.h:317
void setBounds(const VectorXs &xLb, const VectorXs &xUb)
Sets the optimization variable bounds.
Definition: OptVector.h:139
Eigen::Map< const VectorXs > MapConstVecXs
Definition: OptVector.h:29
virtual ~OptVector()=default
Destructor.
void setNewIpoptSolution(const MapConstVecXs &x, const MapConstVecXs &zL, const MapConstVecXs &zU, const MapConstVecXs &lambda)
Extracts the solution from ipopt and stores them into class variables.
Definition: OptVector.h:250
void getOptimizationMultState(const size_t n, MapVecXs &xMul, MapVecXi &xState) const
Return the state and the multiplier of the optimization variables, used in the NLP solver SNOPT...
Definition: OptVector.h:166
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > VectorXs
Definition: OptVector.h:25
void setInitialGuess(const VectorXs &xinit)
Definition: OptVector.h:112
void getLowerBounds(MapVecXs &x) const
Gets the lower bounds of the optimization variables.
Definition: OptVector.h:151
Eigen::Matrix< int, Eigen::Dynamic, 1 > VectorXi
Definition: OptVector.h:26
VectorXs xMul_
Definition: OptVector.h:320
VectorXs zMul_
Definition: OptVector.h:322
void resizeOptimizationVars(const size_t size)
Resizes the vectors of the optimization variables.
Definition: OptVector.h:82
void setOptimizationVars(const VectorXs &x)
Definition: OptVector.h:296
VectorXs x_
Definition: OptVector.h:310
Eigen::Map< VectorXi > MapVecXi
Definition: OptVector.h:28
VectorXs xLb_
Definition: OptVector.h:312
void getInitialGuess(size_t n, MapVecXs &x) const
Definition: OptVector.h:235
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
VectorXi zState_
Definition: OptVector.h:323
void reset()
Definition: OptVector.h:72
VectorXi xState_
Definition: OptVector.h:321
size_t getUpdateCount() const
Returns the update counter.
Definition: OptVector.h:308
void getBoundMultipliers(size_t n, MapVecXs &low, MapVecXs &up) const
Gets the bound multipliers used in the NLP solver IPOPT.
Definition: OptVector.h:203
void resizeConstraintVars(size_t m)
Resizes the vectors of the constraint variables to the correct size.
Definition: OptVector.h:64
Class containing and managing all the optimization variables used for in the NLP solver IPOPT and SNO...
Definition: OptVector.h:21
Eigen::Map< VectorXs > MapVecXs
Definition: OptVector.h:27
VectorXs zUpper_
Definition: OptVector.h:315
const VectorXs & getOptimizationVars() const
Definition: OptVector.h:234
void setOptimizationVars(const MapConstVecXs &x)
Sets the updates optimization variables from the NLP solver and updates the counter.
Definition: OptVector.h:290
OptVector(const size_t n)
{ Constructor resizing the vectors of the optimization variables to the correct size } ...
Definition: OptVector.h:39
void setRandomInitialGuess()
Definition: OptVector.h:106
void setNewSnoptSolution(const MapVecXs &x, const MapVecXs &xMul, const MapVecXi &xState, const MapVecXs &fMul, const MapVecXi &fState)
Extracts the solution from snopt and stores it into class variables.
Definition: OptVector.h:271
size_t size() const
Returns the number of optimization variables.
Definition: OptVector.h:195
void getLambdaVars(size_t m, MapVecXs &x) const
Gets the values of the constraint multipliers.
Definition: OptVector.h:216