QuadraticProgram.quadratic_constraint

QuadraticProgram.quadratic_constraint(linear=None, quadratic=None, sense='<=', rhs=0.0, name=None)[ソース]
Adds a quadratic equality constraint to the quadratic program of the form:

(x * quadratic * x + linear * x) sense rhs.

パラメータ:
  • linear (ndarray | spmatrix | List[float] | Dict[int | str, float] | None) – The linear coefficients of the constraint.

  • quadratic (ndarray | spmatrix | List[List[float]] | Dict[Tuple[int | str, int | str], float] | None) – The quadratic coefficients of the constraint.

  • sense (str | ConstraintSense) –

    The sense of the constraint,

    • ==, =, E, and EQ denote 『equal to』.

    • >=, >, G, and GE denote 『greater-than-or-equal-to』.

    • <=, <, L, and LE 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., q0, is used.

戻り値:

The added constraint.

例外:

QiskitOptimizationError – if the constraint name already exists.

戻り値の型:

QuadraticConstraint