ScsEigen::LinearConstraint class

LinearConstraint is a concrete implementation of Constraint. It implements a constraint of the form.

\[ l \le A x \le u \]

where $x \in \mathbb{R}^n$ is the optimization variable. The linear constraints are defined by matrix $A \in \mathbb{R}^{m \times n}$ and vectors $l$ and $u$ so that $l_i \in \mathbb{R} \cup \{-\infty\}$ and $u_i \in \mathbb{R} \cup \{\infty\}$ for all $i \in \{1,...,m\}$ .

Base classes

class Constraint

Public types

using SparsityPattern = Eigen::Array<bool, Eigen::Dynamic, Eigen::Dynamic>

Constructors, destructors, conversion operators

LinearConstraint() defaulted
Constructor.
LinearConstraint(const Eigen::Ref<const Eigen::MatrixXd>& A, const Eigen::Ref<const Eigen::VectorXd>& lowerBound, const Eigen::Ref<const Eigen::VectorXd>& upperBound, std::optional<Eigen::Ref<const SparsityPattern>> sparsityPattern = {})
Constructor.

Public functions

auto setA(const Eigen::Ref<const Eigen::MatrixXd>& A, std::optional<Eigen::Ref<const SparsityPattern>> sparsityPattern = {}) -> bool
Set the constraint matrix.
auto getA() const -> Eigen::Ref<const Eigen::MatrixXd>
Get the constraint matrix.
auto getASparsityPattern() const -> Eigen::Ref<const SparsityPattern>
Get the sparsity pattern of the constraint matrix A,.

Function documentation

ScsEigen::LinearConstraint::LinearConstraint() defaulted

Constructor.

ScsEigen::LinearConstraint::LinearConstraint(const Eigen::Ref<const Eigen::MatrixXd>& A, const Eigen::Ref<const Eigen::VectorXd>& lowerBound, const Eigen::Ref<const Eigen::VectorXd>& upperBound, std::optional<Eigen::Ref<const SparsityPattern>> sparsityPattern = {})

Constructor.

Parameters
A linear constraint matrix.
lowerBound vector containing the lower bound.
upperBound vector containing the upper bound.
sparsityPattern optional parameter containing the sparsity pattern of the matrix A. If not provided the sparsity pattern is automatically computed.

bool ScsEigen::LinearConstraint::setA(const Eigen::Ref<const Eigen::MatrixXd>& A, std::optional<Eigen::Ref<const SparsityPattern>> sparsityPattern = {})

Set the constraint matrix.

Parameters
A linear constraint matrix.
sparsityPattern optional parameter containing the sparsity pattern of the matrix A. If not provided the sparsity pattern is automatically computed.
Returns true/false in case of success/failure.

Eigen::Ref<const Eigen::MatrixXd> ScsEigen::LinearConstraint::getA() const

Get the constraint matrix.

Returns the constraint matrix A.

Eigen::Ref<const SparsityPattern> ScsEigen::LinearConstraint::getASparsityPattern() const

Get the sparsity pattern of the constraint matrix A,.

Returns the sparsity pattern of A.