dimod.quadratic.Integer

Integer(label: Optional[Hashable] = None, bias: Union[float, numpy.floating, numpy.integer] = 1, dtype: Union[numpy.dtype[Any], None, Type[Any], numpy._typing._dtype_like._SupportsDType[numpy.dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], numpy._typing._dtype_like._DTypeDict, Tuple[Any, Any]] = None, *, lower_bound: float = 0, upper_bound: Optional[float] = None) dimod.quadratic.quadratic_model.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