dimod.ConstrainedQuadraticModel.add_variables#
- ConstrainedQuadraticModel.add_variables(vartype, variables, *, lower_bound=None, upper_bound=None)[source]#
Add variables to the model.
- Parameters:
vartype –
Variable type. One of:
variables – An iterable of variable labels or an integer. An integer
n
is interpreted asrange(n)
.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
.
- Exceptions:
- ValueError: If a variable is added with a different
vartype
, lower_bound
, orupper_bound
. Note that the variables before the inconsistent variable will be added to the model.
- ValueError: If a variable is added with a different