ScsEigen::Constraint class

Constraint class describes a generic convex constraint set of the form

\[ l \le _k f(x) \le _k u \]

Where $ \le _k $ represents a generalized inequality.

Derived classes

class LinearConstraint
class QuadraticConstraint

Constructors, destructors, conversion operators

Constraint() protected defaulted
Constructor,.
Constraint(int numberOfVariables, std::string_view description = "") protected
Constructor,.
~Constraint() defaulted
Desctructor.

Public functions

auto getDescription() const -> std::string_view
Get the description.
auto getNumberOfVariables() const -> int
Get the number of variables.
auto getNumberOfConstraints() const -> int
Get the number of constraints.
auto getLowerBound() const -> Eigen::Ref<const Eigen::VectorXd>
Get the vector containing the lowerBound.
auto getUpperBound() const -> Eigen::Ref<const Eigen::VectorXd>
Get the vector containing the upperBound.

Protected functions

void setDescription(std::string_view description)
Set the description of the constraint.
auto setNumberOfVariables(int numberOfVariables) -> bool
Set the number of variables.
auto setLowerBound(const Eigen::Ref<const Eigen::VectorXd>& lowerBound) -> bool virtual
Set the lower bound.
auto setUpperBound(const Eigen::Ref<const Eigen::VectorXd>& upperBound) -> bool virtual
Set the upper bound.
auto setBounds(const Eigen::Ref<const Eigen::VectorXd>& lowerBound, const Eigen::Ref<const Eigen::VectorXd>& upperBound) -> bool
Set the lower and the upper bounds.
auto setNumberOfConstraints(int numberOfConstraints) -> bool
Set the number of constraints (i.e. the size of lowerBound and upperBound).

Protected variables

std::string m_description
int m_numberOfVariables
int m_numberOfConstraints
Eigen::VectorXd m_lowerBound
Eigen::VectorXd m_upperBound

Function documentation

ScsEigen::Constraint::Constraint(int numberOfVariables, std::string_view description = "") protected

Constructor,.

Parameters
numberOfVariables number of variables associated to the constraint.
description string describing the constraint.

std::string_view ScsEigen::Constraint::getDescription() const

Get the description.

Returns the string containng the description

int ScsEigen::Constraint::getNumberOfVariables() const

Get the number of variables.

Returns the number of variables,

int ScsEigen::Constraint::getNumberOfConstraints() const

Get the number of constraints.

Returns the number of constraints,

Eigen::Ref<const Eigen::VectorXd> ScsEigen::Constraint::getLowerBound() const

Get the vector containing the lowerBound.

Returns the lower bound.

Eigen::Ref<const Eigen::VectorXd> ScsEigen::Constraint::getUpperBound() const

Get the vector containing the upperBound.

Returns the upper bound.

void ScsEigen::Constraint::setDescription(std::string_view description) protected

Set the description of the constraint.

Parameters
description string describing the constraint.

bool ScsEigen::Constraint::setNumberOfVariables(int numberOfVariables) protected

Set the number of variables.

Parameters
numberOfVariables a positive number describing the number of variables.
Returns true in case of success/false otherwise

bool ScsEigen::Constraint::setLowerBound(const Eigen::Ref<const Eigen::VectorXd>& lowerBound) virtual protected

Set the lower bound.

Parameters
lowerBound vector representing the lower bound.
Returns true in case of success/false otherwise

bool ScsEigen::Constraint::setUpperBound(const Eigen::Ref<const Eigen::VectorXd>& upperBound) virtual protected

Set the upper bound.

Parameters
upperBound vector representing the upper bound.
Returns true in case of success/false otherwise

bool ScsEigen::Constraint::setBounds(const Eigen::Ref<const Eigen::VectorXd>& lowerBound, const Eigen::Ref<const Eigen::VectorXd>& upperBound) protected

Set the lower and the upper bounds.

Parameters
lowerBound vector representing the lower bound.
upperBound vector representing the upper bound.
Returns true in case of success/false otherwise

bool ScsEigen::Constraint::setNumberOfConstraints(int numberOfConstraints) protected

Set the number of constraints (i.e. the size of lowerBound and upperBound).

Parameters
numberOfConstraints a positive number describing the size of lowerBound and upperBound.
Returns true in case of success/false otherwise

Variable documentation

std::string ScsEigen::Constraint::m_description protected

Description of the constraint.

int ScsEigen::Constraint::m_numberOfVariables protected

Number of variables associated to the constraint.

int ScsEigen::Constraint::m_numberOfConstraints protected

Size of the constraint.

Eigen::VectorXd ScsEigen::Constraint::m_lowerBound protected

Lower bound.

Eigen::VectorXd ScsEigen::Constraint::m_upperBound protected

Upper bound.