dimod.higherorder.polynomial.BinaryPolynomial.to_hising

BinaryPolynomial.to_hising()[source]

Construct a higher-order Ising problem from a binary polynomial.

Returns:A 3-tuple of the form (h, J, offset) where h includes the linear biases, J has the higher-order biases and offset is the linear offset.
Return type:tuple

Examples

>>> poly = dimod.BinaryPolynomial({'a': -1, 'ab': 1, 'abc': -1}, dimod.SPIN)
>>> h, J, off = poly.to_hising()
>>> h
{'a': -1}