dimod.QuadraticModel.add_variable¶
- QuadraticModel.add_variable(vartype: Union[dimod.vartypes.Vartype, str, frozenset], v: Optional[Hashable] = None, *, lower_bound: float = 0, upper_bound: Optional[float] = None) Hashable [source]¶
Add a variable to the quadratic model.
- Parameters
vartype –
Variable type. One of:
v – Label for the variable. Defaults to the length of the quadratic model, if that label is available. Otherwise defaults to the lowest available positive integer label.
lower_bound – Lower bound on the variable. Ignored when the variable is
BINARY
orSPIN
.upper_bound – Upper bound on the variable. Ignored when the variable is
BINARY
orSPIN
.
- Returns
The variable label.