dimod.quadratic.Integer#

Integer(label: Hashable | None = None, bias: float | floating | integer = 1, dtype: dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any] = None, *, lower_bound: float = 0, upper_bound: float | None = None) QuadraticModel[source]#

Return a quadratic model with a single integer variable.

Parameters:
  • label – Hashable label to identify the variable. Defaults to a generated uuid.UUID as a string.

  • bias – The bias to apply to the variable.

  • dtype – Data type for the returned quadratic model.

  • lower_bound – Keyword-only argument to specify integer lower bound.

  • upper_bound – Keyword-only argument to specify integer upper bound.

Returns:

Instance of QuadraticModel.

Examples

This example generates a quadratic model to represent the polynomial, \(3i - 1.5\), where \(i\) is an integer variable.

>>> i = dimod.Integer('i')
>>> qm = 3*i - 1.5
>>> print(qm.to_polystring())
-1.5 + 3*i