Skip to content

LeapHybridBqm

Leap’s quantum-classical hybrid solvers are intended to solve arbitrary application problems formulated as quadratic models. This solver accepts arbitrarily structured, unconstrained problems formulated as BQMs, with any constraints typically represented through penalty models.


Compatible Backends

The LeapHybridBqm algorithm supports the following backends:

By default, LeapHybridBqm uses the DWaveQpu backend.


Initialization

The following section outlines the default configurations of LeapHybridBqm. You can also specify other compatible backends for the algorithm. When backend=None is specified, the default backend will be initialized automatically. In this case, if the backend requires a token, it will be taken from the environment variables.

Default Configuration
from luna_quantum.solve.parameters.algorithms import LeapHybridBqm

algorithm = LeapHybridBqm(
    backend=None,
    time_limit=None
)

Parameter Details

For a complete overview of available parameters and their usage, see the LeapHybridBqm API Reference.


Usage

from luna_quantum import LunaSolve

LunaSolve.authenticate("<YOUR_LUNA_API_KEY>")

# Define your model and algorithm
model = ...
algorithm = ...

solve_job = algorithm.run(model, name="my-solve-job")

API Reference

Bases: LunaAlgorithm[DWaveQpu]

D-Wave's Leap Hybrid Binary Quadratic Model (BQM) solver.

Leap's hybrid BQM solver is a cloud-based service that combines quantum and classical resources to solve unconstrained binary optimization problems that are larger than what can fit directly on a quantum processor. It automatically handles decomposition, quantum processing, and solution reconstruction.

The hybrid solver is particularly useful for problems with thousands of variables, offering better scaling than classical solvers for many problem types.

Attributes:

Name Type Description
time_limit float | int | None

Maximum running time in seconds. Longer time limits generally produce better solutions but increase resource usage and cost. Default is None, which uses the service's default time limit (typically problem-size dependent).

Note

For a D-Wave backend, this will ignore the decompose parameters as the hybrid solver handles decomposition internally.

backend class-attribute instance-attribute

backend: BACKEND_TYPE | None = Field(default=None, exclude=True, repr=False)

model_config class-attribute instance-attribute

model_config = ConfigDict(
    arbitrary_types_allowed=True, extra="allow", validate_assignment=True
)

time_limit class-attribute instance-attribute

time_limit: float | int | None = None

get_compatible_backends classmethod

get_compatible_backends() -> tuple[type[DWaveQpu], ...]

Check at runtime if the used backend is compatible with the solver.

Returns:

Type Description
tuple[type[IBackend], ...]

True if the backend is compatible with the solver, False otherwise.

get_default_backend classmethod

get_default_backend() -> DWaveQpu

Return the default backend implementation.

This property must be implemented by subclasses to provide the default backend instance to use when no specific backend is specified.

Returns:

Type Description
IBackend

An instance of a class implementing the IBackend interface that serves as the default backend.

run

run(
    model: Model | str,
    name: str | None = None,
    backend: BACKEND_TYPE | None = None,
    client: LunaSolve | str | None = None,
    *args: Any,
    **kwargs: Any,
) -> SolveJob

Run the configured solver.

Parameters:

Name Type Description Default
model Model or str

The model to be optimized or solved. It could be an Model instance or a string identifier representing the model id.

required
name str | None

If provided, the name of the job. Defaults to None.

None
backend BACKEND_TYPE | None

Backend to use for the solver. If not provided, the default backend is used.

None
client LunaSolve or str

The client interface used to interact with the backend services. If not provided, a default client will be used.

None
*args Any

Additional arguments that will be passed to the solver or client.

()
**kwargs Any

Additional keyword parameters for configuration or customization.

{}

Returns:

Type Description
SolveJob

The job object containing the information about the solve process.