Variable
Bases: QuadraticProgramElement
Representation of a variable.
Source code in q3as/quadratic/problems/variable.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
lowerbound: Union[float, int]
property
writable
Returns the lowerbound of the variable.
Returns:
| Type | Description |
|---|---|
Union[float, int]
|
The lower bound of the variable. |
name: str
property
Returns the name of the variable.
Returns:
| Type | Description |
|---|---|
str
|
The name of the variable. |
upperbound: Union[float, int]
property
writable
Returns the upperbound of the variable.
Returns:
| Type | Description |
|---|---|
Union[float, int]
|
The upperbound of the variable. |
vartype: VarType
property
writable
__init__(quadratic_program, name, lowerbound=0, upperbound=INFINITY, vartype=VarType.CONTINUOUS)
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:
| Name | Type | Description | Default |
|---|---|---|---|
quadratic_program |
Any
|
The parent QuadraticProgram. |
required |
name |
str
|
The variable name. |
required |
lowerbound |
Union[float, int]
|
The variable lowerbound. |
0
|
upperbound |
Union[float, int]
|
The variable upperbound. |
INFINITY
|
vartype |
VarType
|
The variable type. |
CONTINUOUS
|
Raises:
| Type | Description |
|---|---|
QiskitOptimizationError
|
if lowerbound is greater than upperbound. |
Source code in q3as/quadratic/problems/variable.py
as_tuple()
Returns a tuple corresponding to this variable.
Returns:
| Type | Description |
|---|---|
str
|
A tuple corresponding to this variable consisting of name, lowerbound, upperbound and |
Union[float, int]
|
variable type. |