QuadraticConstraint
Bases: Constraint
Representation of a quadratic constraint.
Source code in q3as/quadratic/problems/quadratic_constraint.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
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. |
quadratic: QuadraticExpression
property
writable
Returns the quadratic expression corresponding to the left-hand-side of the constraint.
Returns:
| Type | Description |
|---|---|
QuadraticExpression
|
The left-hand-side quadratic expression. |
__init__(quadratic_program, name, linear, quadratic, sense, rhs)
Constructs a quadratic constraint, consisting of a linear and a quadratic term.
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 part of the constraint. |
required |
quadratic |
Union[ndarray, spmatrix, List[List[float]], Dict[Tuple[Union[int, str], Union[int, str]], float]]
|
The coefficients specifying the linear part of the 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/quadratic_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. |