qiskit_addon_opt_mapper.problems.Variable¶
- class Variable(optimization_problem, name, lowerbound=0, upperbound=1e+20, vartype=VarType.CONTINUOUS)[source]¶
Bases:
OptimizationProblemElementRepresentation of a variable.
Creates a new Variable.
The variables is exposed by the top-level OptimizationProblem class in OptimizationProblem.variables. This constructor is not meant to be used externally.
- Parameters:
- Raises:
OptimizationError – if lowerbound is greater than upperbound.
- __init__(optimization_problem, name, lowerbound=0, upperbound=1e+20, vartype=VarType.CONTINUOUS)[source]¶
Creates a new Variable.
The variables is exposed by the top-level OptimizationProblem class in OptimizationProblem.variables. This constructor is not meant to be used externally.
- Parameters:
- Raises:
OptimizationError – if lowerbound is greater than upperbound.
- Return type:
None
Methods
__init__(optimization_problem, name[, ...])Creates a new Variable.
as_tuple()Returns a tuple corresponding to this variable.
Attributes
Returns the lowerbound of the variable.
Returns the name of the variable.
Returns the parent OptimizationProblem.
Returns the upperbound of the variable.
Returns the type of the variable.
- property lowerbound: float | int¶
Returns the lowerbound of the variable.
- Returns:
The lower bound of the variable.
- property optimization_problem: OptimizationProblem¶
Returns the parent OptimizationProblem.
- Returns:
The parent OptimizationProblem.
- property upperbound: float | int¶
Returns the upperbound of the variable.
- Returns:
The upperbound of the variable.
- property vartype: VarType¶
Returns the type of the variable.
- Returns:
The variable type.