136 lines
3.6 KiB
Plaintext
136 lines
3.6 KiB
Plaintext
---
|
||
title: QuadraticConstraint (v0.29)
|
||
description: API reference for qiskit.optimization.problems.QuadraticConstraint in qiskit v0.29
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.optimization.problems.QuadraticConstraint
|
||
---
|
||
|
||
# QuadraticConstraint
|
||
|
||
<Class id="qiskit.optimization.problems.QuadraticConstraint" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/problems/quadratic_constraint.py" signature="QuadraticConstraint(quadratic_program, name, linear, quadratic, sense, rhs)" modifiers="class">
|
||
Bases: `qiskit.optimization.problems.constraint.Constraint`
|
||
|
||
Representation of a quadratic constraint.
|
||
|
||
Constructs a quadratic constraint, consisting of a linear and a quadratic term.
|
||
|
||
**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 part of the constraint.
|
||
* **quadratic** (`Union`\[`ndarray`, `spmatrix`, `List`\[`List`\[`float`]], `Dict`\[`Tuple`\[`Union`\[`int`, `str`], `Union`\[`int`, `str`]], `float`]]) – The coefficients specifying the linear part of the constraint.
|
||
* **sense** (`ConstraintSense`) – The sense of the constraint.
|
||
* **rhs** (`float`) – The right-hand-side of the constraint.
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-optimization-problems-quadraticconstraint-evaluate" />
|
||
|
||
### evaluate
|
||
|
||
<Function id="qiskit.optimization.problems.QuadraticConstraint.evaluate" signature="QuadraticConstraint.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.QuadraticConstraint.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.QuadraticConstraint.name">
|
||
Returns the name of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`str`
|
||
|
||
**Returns**
|
||
|
||
The name of the constraint.
|
||
</Attribute>
|
||
|
||
### quadratic
|
||
|
||
<Attribute id="qiskit.optimization.problems.QuadraticConstraint.quadratic">
|
||
Returns the quadratic expression corresponding to the left-hand-side of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`QuadraticExpression`
|
||
|
||
**Returns**
|
||
|
||
The left-hand-side quadratic expression.
|
||
</Attribute>
|
||
|
||
### quadratic\_program
|
||
|
||
<Attribute id="qiskit.optimization.problems.QuadraticConstraint.quadratic_program">
|
||
Returns the parent QuadraticProgram.
|
||
|
||
**Return type**
|
||
|
||
`Any`
|
||
|
||
**Returns**
|
||
|
||
The parent QuadraticProgram.
|
||
</Attribute>
|
||
|
||
### rhs
|
||
|
||
<Attribute id="qiskit.optimization.problems.QuadraticConstraint.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.QuadraticConstraint.sense">
|
||
Returns the sense of the constraint.
|
||
|
||
**Return type**
|
||
|
||
`ConstraintSense`
|
||
|
||
**Returns**
|
||
|
||
The sense of the constraint.
|
||
</Attribute>
|
||
</Class>
|
||
|