Leap Service’s Hybrid Solvers#
This section introduces the Leap service’s quantum-classical hybrid solvers and provides references to usage information.
Note
Not all accounts have access to this type of solver.
Supported Solvers#
The quantum-classical hybrid solvers in the Leap service are intended to solve arbitrary application problems formulated as a quadratic model or nonlinear model[1].
These solvers, which implement state-of-the-art classical algorithms together with intelligent allocation of the quantum computer to parts of the problem where it benefits most, are designed to accommodate even very large problems. Hybrid solvers enable you to benefit from D-Wave’s deep investment in researching, developing, optimizing, and maintaining hybrid algorithms.
The generally available hybrid solvers depend on your account in the Leap service. Check your dashboard to see which hybrid solvers are available to you.
Generally available hybrid solvers currently supported include:
Hybrid nonlinear-program solver (e.g.,
hybrid_nonlinear_program_version1
)Nonlinear models typically represent general optimization problems with an objective function and/or one or more constraints over integer and/or binary variables; the model supports constraints natively.
This model is especially suited for use with decision variables that represent a common logic, such as subsets of choices or permutations of ordering. For example, in a traveling salesperson problem permutations of the variables representing cities can signify the order of the route being optimized and in a knapsack problem the variables representing items can be divided into subsets of packed and not packed.
These solvers accept arbitrarily structured problems formulated as nonlinear models, with any constraints represented natively.
Hybrid CQM solver (e.g.,
hybrid_constrained_quadratic_model_version1
)Constrained quadratic models (CQM) are typically used for applications that optimize problems that might include binary-valued variables (both \(0/1\)-valued variables and \(-1/1\)-valued variables), integer-valued variables, and real variables (also known as continuous variables); the model supports constraints natively.
These solvers accept arbitrarily structured problems formulated as CQMs, with any constraints represented natively.
Hybrid BQM solver (e.g.,
hybrid_binary_quadratic_model_version2
)Binary quadratic models (BQM) are unconstrained and typically represent problems of decisions that could either be true (or yes) or false (no); for example, should an antenna transmit, or did a network node fail? The model uses \(0/1\)-valued variables and \(-1/1\)-valued variables; constraints are typically represented as penalty models.
These solvers accept arbitrarily structured, unconstrained problems formulated as BQMs, with any constraints typically represented through penalty models.
Hybrid DQM solver (e.g.,
hybrid_discrete_quadratic_model_version1
)Discrete quadratic models (DQM) are unconstrained and typically represent problems with several distinct options; for example, which shift should employee X work, or should the state on a map be colored red, blue, green, or yellow? The model uses variables that can represent a set of values such as
{red, green, blue, yellow}
or{3.2, 67}
; constraints are typically represented as penalty models.These solvers accept arbitrarily structured, unconstrained problems formulated as DQMs, with any constraints typically represented through penalty models.
Contact D-Wave at sales@dwavesys.com if your application requires scale or performance that exceeds the currently advertised capabilities of the generally available hybrid solvers.
Solver Properties and Parameters#
The following table provides links to documentation for the properties and parameters of the hybrid solvers in the Leap service.
Solver for Model |
Properties |
Parameters |
---|---|---|
Solver Timing#
The table below lists the timing information returned from quantum-classical hybrid solvers in the Leap service.
Field |
Meaning |
---|---|
run_time |
Time, in microseconds, the hybrid solver spent working on the problem. |
charge_time |
Time, in microseconds, charged to the account.[2] |
qpu_access_time |
QPU time, in microseconds, used by the hybrid solver.[3] |
charge_time and run_time may differ due to the time granularity of the solver. For example, if a hybrid solver has a time granularity of 0.5 sec and your submission specifies 4.7 sec, run_time might be 5 sec and charge_time 4.5 sec.
qpu_access_time might be zero for submissions with short run_time. Because the QPU is a shared, remote resource, the first set of samples from the QPU might not be received before a short explicitly-specified or default time_limit is reached. In such cases, the hybrid solver respects the time limitation and returns without the QPU having a chance to contribute to the solution. On the large, complex problems for which hybrid solvers are intended, this is unlikely to occur.
You can access this information via the dimod
SampleSet
class, as in the example below.
>>> import dimod
>>> from dwave.system import LeapHybridSampler
...
>>> sampler = LeapHybridSampler(solver={'category': 'hybrid'})
>>> bqm = dimod.generators.ran_r(1, 300)
>>> sampleset = sampler.sample(bqm)
>>> sampleset.info
{'qpu_access_time': 41990, 'charge_time': 2991424, 'run_time': 2991424}
Solver Usage Charges#
D-Wave charges you for time that solvers run your problems,
with rates depending on QPU usage. You can see the rate at which
your account’s quota is consumed for a particular solver in the solver’s
property_quota_rate
property; for example,
quota_conversion_rate for the nonlinear solver.
You can see the time you are charged for in the responses returned for your
submitted problems. The relevant field in the response is 'charge_time'
.
The example in the Solver Timing section shows
'charge_time': 2991424'
in the returned response, meaning almost 3
seconds are being charged.
Instantiating the needed compute resources for your problem can introduce a delay before the problem is processed. This delay tends to be small compared to the overall solution time for large problems. The charge_time does not include this delay.
Usage Examples#
Use a hybrid solver as you would any Ocean SDK sampler. For example, given a 1000-variable problem formulated as a quadratic unconstrained binary optimization (QUBO) model, \(Q\), you can submit it for solution to a hybrid BQM solver as follows:
from dwave.system import LeapHybridSampler
# Select a solver
sampler = LeapHybridSampler()
# Submit for solution
answer = sampler.sample_qubo(Q)
You can find more usage examples here:
Traveling Salesperson: Simple Nonlinear Model for the nonlinear solver.
Vehicle Routing: Using a Nonlinear Model for the nonlinear solver.
Bin Packing: Binary CQM for the CQM solver.
Stock Sales: Integer CQM for the CQM solver.
Structural Imbalance: BQM Solver for the BQM solver.
D-Wave’s GitHub repository, dwave-examples, which includes Jupyter notebooks and code examples for various types of problems, such as the knapsack problem.