LinearConstraint
Bases: Constraint
Representation of a linear constraint.
Source code in q3as/quadratic/problems/linear_constraint.py
linear: LinearExpression
property
writable
Returns the linear expression corresponding to the left-hand-side of the constraint.
Returns:
| Type | Description |
|---|---|
LinearExpression
|
The left-hand-side linear expression. |
__init__(quadratic_program, name, linear, sense, rhs)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quadratic_program |
Any
|
The parent quadratic program. |
required |
name |
str
|
The name of the constraint. |
required |
linear |
Union[ndarray, spmatrix, List[float], Dict[Union[str, int], float]]
|
The coefficients specifying the linear constraint. |
required |
sense |
ConstraintSense
|
The sense of the constraint. |
required |
rhs |
float
|
The right-hand-side of the constraint. |
required |
Source code in q3as/quadratic/problems/linear_constraint.py
evaluate(x)
Evaluate the left-hand-side of the constraint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
Union[ndarray, List, Dict[Union[int, str], float]]
|
The values of the variables to be evaluated. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The left-hand-side of the constraint given the variable values. |