LinearConstraint#

class LinearConstraint(quadratic_program, name, linear, sense, rhs)[source]#

Bases: Constraint

Representation of a linear constraint.

Parameters:
  • quadratic_program (Any) – The parent quadratic program.

  • name (str) – The name of the constraint.

  • linear (ndarray | spmatrix | List[float] | Dict[int | str, float]) – The coefficients specifying the linear constraint.

  • sense (ConstraintSense) – The sense of the constraint.

  • rhs (float) – The right-hand-side of the constraint.

Attributes

linear#

Returns the linear expression corresponding to the left-hand-side of the constraint.

Returns:

The left-hand-side linear expression.

name#

Returns the name of the constraint.

Returns:

The name of the constraint.

quadratic_program#

Returns the parent QuadraticProgram.

Returns:

The parent QuadraticProgram.

rhs#

Returns the right-hand-side of the constraint.

Returns:

The right-hand-side of the constraint.

sense#

Returns the sense of the constraint.

Returns:

The sense of the constraint.

Methods

evaluate(x)[source]#

Evaluate the left-hand-side of the constraint.

Parameters:

x (ndarray | List | Dict[int | str, float]) – The values of the variables to be evaluated.

Returns:

The left-hand-side of the constraint given the variable values.

Return type:

float