121 lines
2.9 KiB
Plaintext
121 lines
2.9 KiB
Plaintext
---
|
||
title: Variable
|
||
description: API reference for qiskit.optimization.problems.Variable
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.optimization.problems.Variable
|
||
---
|
||
|
||
# Variable
|
||
|
||
<Class id="qiskit.optimization.problems.Variable" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/problems/variable.py" signature="Variable(quadratic_program, name, lowerbound=0, upperbound=1e+20, vartype=<VarType.CONTINUOUS: 0>)" modifiers="class">
|
||
Bases: `qiskit.optimization.problems.quadratic_program_element.QuadraticProgramElement`
|
||
|
||
Representation of a variable.
|
||
|
||
Creates a new Variable.
|
||
|
||
The variables is exposed by the top-level QuadraticProgram class in QuadraticProgram.variables. This constructor is not meant to be used externally.
|
||
|
||
**Parameters**
|
||
|
||
* **quadratic\_program** (`Any`) – The parent QuadraticProgram.
|
||
* **name** (`str`) – The variable name.
|
||
* **lowerbound** (`Union`\[`float`, `int`]) – The variable lowerbound.
|
||
* **upperbound** (`Union`\[`float`, `int`]) – The variable upperbound.
|
||
* **vartype** (`VarType`) – The variable type.
|
||
|
||
**Raises**
|
||
|
||
[**QiskitOptimizationError**](qiskit.optimization.QiskitOptimizationError "qiskit.optimization.QiskitOptimizationError") – if lowerbound is greater than upperbound.
|
||
|
||
## Methods
|
||
|
||
### as\_tuple
|
||
|
||
<Function id="qiskit.optimization.problems.Variable.as_tuple" signature="Variable.as_tuple()">
|
||
Returns a tuple corresponding to this variable.
|
||
|
||
**Return type**
|
||
|
||
`Tuple`\[`str`, `Union`\[`float`, `int`], `Union`\[`float`, `int`], `VarType`]
|
||
|
||
**Returns**
|
||
|
||
A tuple corresponding to this variable consisting of name, lowerbound, upperbound and variable type.
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### lowerbound
|
||
|
||
<Attribute id="qiskit.optimization.problems.Variable.lowerbound">
|
||
Returns the lowerbound of the variable.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`float`, `int`]
|
||
|
||
**Returns**
|
||
|
||
The lower bound of the variable.
|
||
</Attribute>
|
||
|
||
### name
|
||
|
||
<Attribute id="qiskit.optimization.problems.Variable.name">
|
||
Returns the name of the variable.
|
||
|
||
**Return type**
|
||
|
||
`str`
|
||
|
||
**Returns**
|
||
|
||
The name of the variable.
|
||
</Attribute>
|
||
|
||
### quadratic\_program
|
||
|
||
<Attribute id="qiskit.optimization.problems.Variable.quadratic_program">
|
||
Returns the parent QuadraticProgram.
|
||
|
||
**Return type**
|
||
|
||
`Any`
|
||
|
||
**Returns**
|
||
|
||
The parent QuadraticProgram.
|
||
</Attribute>
|
||
|
||
### upperbound
|
||
|
||
<Attribute id="qiskit.optimization.problems.Variable.upperbound">
|
||
Returns the upperbound of the variable.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`float`, `int`]
|
||
|
||
**Returns**
|
||
|
||
The upperbound of the variable.
|
||
</Attribute>
|
||
|
||
### vartype
|
||
|
||
<Attribute id="qiskit.optimization.problems.Variable.vartype">
|
||
Returns the type of the variable.
|
||
|
||
**Return type**
|
||
|
||
`VarType`
|
||
|
||
**Returns**
|
||
|
||
The variable type.
|
||
</Attribute>
|
||
</Class>
|
||
|