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 as range(n).

  • lower_bound – Lower bound on the variable. Ignored when the variable is BINARY or SPIN.

  • upper_bound – Upper bound on the variable. Ignored when the variable is BINARY or SPIN.

Exceptions:
ValueError: If a variable is added with a different vartype,

lower_bound, or upper_bound. Note that the variables before the inconsistent variable will be added to the model.