Variable#

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

Bases: 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.

Parámetros:
  • quadratic_program (Any) – The parent QuadraticProgram.

  • name (str) – The variable name.

  • lowerbound (float | int) – The variable lowerbound.

  • upperbound (float | int) – The variable upperbound.

  • vartype (VarType) – The variable type.

Muestra:

QiskitOptimizationError – if lowerbound is greater than upperbound.

Attributes

lowerbound#

Returns the lowerbound of the variable.

Devuelve:

The lower bound of the variable.

name#

Returns the name of the variable.

Devuelve:

The name of the variable.

quadratic_program#

Returns the parent QuadraticProgram.

Devuelve:

The parent QuadraticProgram.

upperbound#

Returns the upperbound of the variable.

Devuelve:

The upperbound of the variable.

vartype#

Returns the type of the variable.

Devuelve:

The variable type.

Methods

as_tuple()[fuente]#

Returns a tuple corresponding to this variable.

Devuelve:

A tuple corresponding to this variable consisting of name, lowerbound, upperbound and variable type.

Tipo del valor devuelto:

Tuple[str, float | int, float | int, VarType]