# Using Hybrid Solvers¶

D-Wave offers two complementary approaches to quantum-classical hybrid computing:

Leap hybrid solvers.

D-Wave’s Leap quantum cloud service provides cloud-based hybrid solvers you can submit arbitrary BQMs to. These solvers, which implement state-of-the-art classical algorithms together with intelligent allocation of the quantum processing unit (QPU) to parts of the problem where it benefits most, are designed to accommodate even very large problems. Leap’s solvers can relieve you of the burden of any current and future development and optimization of hybrid algorithms that best solve your problem.

The Using Leap’s Hybrid Solvers page provides basic information on these solvers and pointers to relevant documentation on properties, parameters, timing etc.

Ocean software’s dwave-hybrid.

The

*dwave-hybrid*tool provides you with a Python framework for building a variety of flexible hybrid workflows. These use quantum and classical resources together to find good solutions to your problem. For example, a hybrid workflow might use classical resources to find a problem’s hard core and send that to the QPU, or break a large problem into smaller pieces that can be solved on a QPU and then recombined.The

*dwave-hybrid*framework enables rapid development of experimental prototypes, which provide insight into expected performance of the productized versions. It provides reference samplers and workflows you can quickly plug into your application code. You can easily experiment with customizing workflows that best solve your problem. You can also develop your own hybrid components to optimize performance.For usage, see the dwave-hybrid documentation.

The following sections provide some guidance on using hybrid solvers to best solve your problems.

## Reformulation¶

The guidance detailed in the General Guidance on Reformulating section is applicable to hybrid solvers. Although, for example, limitations on problem size are vastly expanded compared to QPU solvers, formulations that proliferate ancillary variables might still perform less well than alternative formulations.

## dwave-hybrid Hybrid Framework¶

The Hybrid Computing
Jupyter Notebooks explain and demonstrate how to develop and use the
*dwave-hybrid* hybrid solvers and development framework.

The *dwave-hybrid* framework and its reference solvers enable a higher degree
of user control than Leap’s hybrid solvers. Whether you are developing your own
hybrid workflows or tuning the performance of provided *dwave-hybrid* solvers,
your solutions may benefit from applying some of the guidance of the
QPU Solvers: Decomposing Large Problems, QPU Solvers: Minor-Embedding, and QPU Solvers: Configuration chapters.

## Leap’s Hybrid Solvers¶

The following guidance applies to Leap’s hybrid solvers.

### Large-Problem Construction¶

For large problems, attention should be given to the number of biases created for models (BQMs, DQMs). Generating models with huge numbers of biases may exhaust resources such as memory on your local machine and uploads to Leap may tax your connection’s bandwidth.

To enable best performance of your local machine and application, consider such points as the following:

Before constructing extremely large problems, verify that your local machine has sufficient resources (such as memory) to support possibly millions of biases.

Problems can be formulated with more performant software structures such as BQMs built from NumPy vectors rather than Python dicts.

See dimod’s BQM classes for examples.

Uploading huge problems to Leap can take time and may require significant bandwidth from your Internet link. Consider using compression where supported by your selected hybrid solver.

### Run Times¶

Hybrid solvers enable you to configure the time the solver runs your problem.

For many heuristic solvers, solution quality as a function of runtime is highly dependent on the problem being solved. Consequently, hybrid solvers can set a default runtime that is either short and insufficient for many problems or long and expensive for many problems. Leap’s hybrid solvers set as the default runtime a minimum time based on the number of problem variables.

**Running a hybrid solver with the default** time_limit **parameter
does not guarantee a good solution.**

Depending on the size and complexity of your problem, there are a number of strategies you can use for setting appropriate runtimes.

- Use the default, see if the returned solutions are good enough for your needs. If not, keep doubling the runtime until good solutions are produced or solutions remain unchanged.
- Set a runtime based on experiments with similar problems.
- Set a runtime based on considerations of the context in which your application runs: cost, available time for processing, solution quality required, etc.