qiskit_addon_opt_mapper.problems.LinearConstraint¶
- class LinearConstraint(optimization_problem, name, linear, sense, rhs)[source]¶
 Bases:
ConstraintRepresentation of a linear constraint.
Init method.
- Parameters:
 optimization_problem (Any) – The parent optimization problem.
name (str) – The name of the constraint.
linear (ndarray | spmatrix | list[float] | dict[str | int, float]) – The coefficients specifying the linear constraint.
sense (ConstraintSense) – The sense of the constraint.
rhs (float) – The right-hand-side of the constraint.
- __init__(optimization_problem, name, linear, sense, rhs)[source]¶
 Init method.
- Parameters:
 optimization_problem (Any) – The parent optimization problem.
name (str) – The name of the constraint.
linear (ndarray | spmatrix | list[float] | dict[str | int, float]) – The coefficients specifying the linear constraint.
sense (ConstraintSense) – The sense of the constraint.
rhs (float) – The right-hand-side of the constraint.
- Return type:
 None
Methods
__init__(optimization_problem, name, linear, ...)Init method.
evaluate(x)Evaluate the left-hand-side of the constraint.
Attributes
Returns the linear expression corresponding to the left-hand-side of the constraint.
Returns the name of the constraint.
Returns the parent OptimizationProblem.
Returns the right-hand-side of the constraint.
Returns the sense of the constraint.
- property linear: LinearExpression¶
 Returns the linear expression corresponding to the left-hand-side of the constraint.
- Returns:
 The left-hand-side linear expression.
- property optimization_problem: OptimizationProblem¶
 Returns the parent OptimizationProblem.
- Returns:
 The parent OptimizationProblem.
- property rhs: float¶
 Returns the right-hand-side of the constraint.
- Returns:
 The right-hand-side of the constraint.
- property sense: ConstraintSense¶
 Returns the sense of the constraint.
- Returns:
 The sense of the constraint.