QuadraticProgram.linear_constraint¶
- QuadraticProgram.linear_constraint(linear=None, sense='<=', rhs=0.0, name=None)[fuente]¶
- Adds a linear equality constraint to the quadratic program of the form:
(linear * x) sense rhs
.
- Parámetros:
linear (ndarray | spmatrix | List[float] | Dict[int | str, float] | None) – The linear coefficients of the left-hand side of the constraint.
sense (str | ConstraintSense) –
The sense of the constraint,
==
,=
,E
, andEQ
denote “equal to”.>=
,>
,G
, andGE
denote “greater-than-or-equal-to”.<=
,<
,L
, andLE
denote “less-than-or-equal-to”.
rhs (float) – The right-hand side of the constraint.
name (str | None) – The name of the constraint. If it’s
None
or empty""
, the default name, e.g.,c0
, is used.
- Devuelve:
The added constraint.
- Muestra:
QiskitOptimizationError – if the constraint name already exists or the sense is not valid.
- Tipo del valor devuelto: