dimod.QuadraticModel.add_variables_from#

QuadraticModel.add_variables_from(vartype: Vartype | str | frozenset, variables: Iterable[Hashable])[source]#

Add multiple variables of the same type to the quadratic model.

Parameters:
  • vartype

    Variable type. One of:

  • variables – Iterable of variable labels.

Examples

>>> from dimod import QuadraticModel, Binary
>>> qm = QuadraticModel()
>>> qm.add_variables_from('BINARY', ['x', 'y'])