OsqpEigen::Data class

Data class is a wrapper of the OSQP OSQPData struct.

Constructors, destructors, conversion operators

Data()
Constructor.
Data(int n, int m)
Constructor.
~Data()
Deconstructor.

Public functions

void clearHessianMatrix()
Clear the hessian matrix.
void clearLinearConstraintsMatrix()
Clear the linear constraints matrix.
void setNumberOfVariables(int n)
Set the number of variables.
void setNumberOfConstraints(int m)
Set the number of constraints.
template<typename Derived>
auto setHessianMatrix(const Eigen::SparseCompressedBase<Derived>& hessianMatrix) -> bool
Set the quadratic part of the cost function (Hessian).
auto setGradient(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> gradientVector) -> bool
Set the linear part of the cost function (Gradient).
auto getGradient() -> Eigen::Matrix<c_float, Eigen::Dynamic, 1>
template<typename Derived>
auto setLinearConstraintsMatrix(const Eigen::SparseCompressedBase<Derived>& linearConstraintsMatrix) -> bool
Set the linear constraint matrix A (size m x n)
auto setLowerBound(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> lowerBoundVector) -> bool
Set the array for lower bound (size m).
auto setUpperBound(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBoundVector) -> bool
Set the array for upper bound (size m).
auto setBounds(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> lowerBound, Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBound) -> bool
Set the array for upper and lower bounds (size m).
auto getData() const -> OSQPData*const &
Get the OSQPData struct.
auto isSet() const -> bool
Verify if all the matrix and vectors are already set.

Function documentation

OsqpEigen::Data::Data(int n, int m)

Constructor.

Parameters
n is the number of variables;
m is the number of constraints.

void OsqpEigen::Data::setNumberOfVariables(int n)

Set the number of variables.

Parameters
n is the number of variables.

void OsqpEigen::Data::setNumberOfConstraints(int m)

Set the number of constraints.

Parameters
m is the number of constraints.

template<typename Derived>
bool OsqpEigen::Data::setHessianMatrix(const Eigen::SparseCompressedBase<Derived>& hessianMatrix)

Set the quadratic part of the cost function (Hessian).

Parameters
hessianMatrix is the Hessian matrix.
Returns true/false in case of success/failure.

It is assumed to be a symmetric matrix.

bool OsqpEigen::Data::setGradient(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> gradientVector)

Set the linear part of the cost function (Gradient).

Parameters
gradientVector is the Gradient vector.
Returns true/false in case of success/failure.

template<typename Derived>
bool OsqpEigen::Data::setLinearConstraintsMatrix(const Eigen::SparseCompressedBase<Derived>& linearConstraintsMatrix)

Set the linear constraint matrix A (size m x n)

Parameters
linearConstraintsMatrix is the linear constraints matrix A.
Returns true/false in case of success/failure.

bool OsqpEigen::Data::setLowerBound(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> lowerBoundVector)

Set the array for lower bound (size m).

Parameters
lowerBoundVector is the lower bound constraint.
Returns true/false in case of success/failure.

bool OsqpEigen::Data::setUpperBound(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBoundVector)

Set the array for upper bound (size m).

Parameters
upperBoundVector is the upper bound constraint.
Returns true/false in case of success/failure.

bool OsqpEigen::Data::setBounds(Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> lowerBound, Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBound)

Set the array for upper and lower bounds (size m).

Parameters
lowerBound is the lower bound constraint.
upperBound is the upper bound constraint.
Returns true/false in case of success/failure.

OSQPData*const & OsqpEigen::Data::getData() const

Get the OSQPData struct.

Returns a const point to the OSQPData struct.

bool OsqpEigen::Data::isSet() const

Verify if all the matrix and vectors are already set.

Returns true if all the OSQPData struct are set.