119 lines
2.9 KiB
Plaintext
119 lines
2.9 KiB
Plaintext
---
|
||
title: LinearConstraint (v0.31)
|
||
description: API reference for qiskit.optimization.problems.LinearConstraint in qiskit v0.31
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.optimization.problems.LinearConstraint
|
||
---
|
||
|
||
# LinearConstraint
|
||
|
||
<Class id="qiskit.optimization.problems.LinearConstraint" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/problems/linear_constraint.py" signature="LinearConstraint(quadratic_program, name, linear, sense, rhs)" modifiers="class">
|
||
Bases: `qiskit.optimization.problems.constraint.Constraint`
|
||
|
||
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.
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-optimization-problems-linearconstraint-evaluate" />
|
||
|
||
### evaluate
|
||
|
||
<Function id="qiskit.optimization.problems.LinearConstraint.evaluate" signature="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.
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### linear
|
||
|
||
<Attribute id="qiskit.optimization.problems.LinearConstraint.linear">
|
||
Returns the linear expression corresponding to the left-hand-side of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`LinearExpression`
|
||
|
||
**Returns**
|
||
|
||
The left-hand-side linear expression.
|
||
</Attribute>
|
||
|
||
### name
|
||
|
||
<Attribute id="qiskit.optimization.problems.LinearConstraint.name">
|
||
Returns the name of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`str`
|
||
|
||
**Returns**
|
||
|
||
The name of the constraint.
|
||
</Attribute>
|
||
|
||
### quadratic\_program
|
||
|
||
<Attribute id="qiskit.optimization.problems.LinearConstraint.quadratic_program">
|
||
Returns the parent QuadraticProgram.
|
||
|
||
**Return type**
|
||
|
||
`Any`
|
||
|
||
**Returns**
|
||
|
||
The parent QuadraticProgram.
|
||
</Attribute>
|
||
|
||
### rhs
|
||
|
||
<Attribute id="qiskit.optimization.problems.LinearConstraint.rhs">
|
||
Returns the right-hand-side of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`float`
|
||
|
||
**Returns**
|
||
|
||
The right-hand-side of the constraint.
|
||
</Attribute>
|
||
|
||
### sense
|
||
|
||
<Attribute id="qiskit.optimization.problems.LinearConstraint.sense">
|
||
Returns the sense of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`ConstraintSense`
|
||
|
||
**Returns**
|
||
|
||
The sense of the constraint.
|
||
</Attribute>
|
||
</Class>
|
||
|