Non-Binary and Non-Quadratic Models

dimod also supports discrete quadratic models (DQMs) and provides some Higher-Order Composites and functionality such as reducing higher-order polynomials to BQMs.

Discrete Quadratic Models

For an introduction to DQMs, see Discrete Quadratic Models.

See examples of using Leap hybrid DQM solvers in the dwave-examples GitHub repository.

Higher-Order Models

This example uses dimod’s ExactSolver reference sampler on a higher-order unconstrained binary optimization (HUBO) model.

>>> import dimod
>>> poly = dimod.BinaryPolynomial.from_hubo({('a', 'a'): -1,
...                                          ('a', 'b'): -0.5,
...                                          ('a', 'b', 'c'): -2})
>>> sampler = dimod.HigherOrderComposite(dimod.ExactSolver())
>>> sampleset = sampler.sample_poly(poly)
>>> print(sampleset.first.sample["a"])