Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

Variable

class Variable(quadratic_program, name, lowerbound=0, upperbound=1e+20, vartype=VarType.CONTINUOUS)

GitHub

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 – if lowerbound is greater than upperbound.


Attributes

lowerbound

Type: Union[float, int]

Returns the lowerbound of the variable.

Return type

Union[float, int]

Returns

The lower bound of the variable.

name

Type: str

Returns the name of the variable.

Return type

str

Returns

The name of the variable.

quadratic_program

Type: Any

Returns the parent QuadraticProgram.

Return type

Any

Returns

The parent QuadraticProgram.

upperbound

Type: Union[float, int]

Returns the upperbound of the variable.

Return type

Union[float, int]

Returns

The upperbound of the variable.

vartype

Type: qiskit.optimization.problems.variable.VarType

Returns the type of the variable.

Return type

VarType

Returns

The variable type.


Methods

as_tuple

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.

Was this page helpful?
Report a bug or request content on GitHub.