Get Started with Optimization#
Learn to solve hard optimization problems using quantum-classical hybrid solvers hosted in the Leap™ quantum cloud service.
Example#
The following code creates a constrained quadratic model (CQM) representing a knapsack problem and solves it using a quantum-classical hybrid solver in the Leap service.
>>> from dimod.generators import random_knapsack
>>> from dwave.system import LeapHybridCQMSampler
...
>>> cqm = random_knapsack(10)
>>> sampler = LeapHybridCQMSampler()
>>> sampleset = sampler.sample_cqm(cqm,
... time_limit=180,
... label="SDK Examples - Bin Packing")