Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

LinearConstraint

LinearConstraint(quadratic_program, name, linear, sense, rhs) GitHub(opens in a new tab)

Representation of a linear constraint.

Parameters

  • quadratic_program (Any) – The parent quadratic program.
  • name (str) – The name of the constraint.
  • linear (Union[ndarray, spmatrix, List[float], Dict[Union[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

qiskit.optimization.problems.linear_expression.LinearExpression

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

Return type

LinearExpression

Returns

The left-hand-side linear expression.

name

str

Returns the name of the constraint.

Return type

str

Returns

The name of the constraint.

quadratic_program

Any

Returns the parent QuadraticProgram.

Return type

Any

Returns

The parent QuadraticProgram.

rhs

float

Returns the right-hand-side of the constraint.

Return type

float

Returns

The right-hand-side of the constraint.

sense

qiskit.optimization.problems.constraint.ConstraintSense

Returns the sense of the constraint.

Return type

ConstraintSense

Returns

The sense of the constraint.


Methods

evaluate

LinearConstraint.evaluate(x)

Evaluate the left-hand-side of the constraint.

Parameters

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

Return type

float

Returns

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

Was this page helpful?