Skip to content

QuantumAnnealing

Quantum Annealing uses D-Wave’s purpose build Quantum Processing Units (QPU) to solve QUBO optimization problems with the help of the adiabatic theorem of quantum mechanics. This implementation first applies D-Wave’s minor embedding to map the provided problem onto the hardware graph of the desired sampler.


Compatible Backends

The QuantumAnnealing algorithm supports the following backends:

By default, QuantumAnnealing uses the DWaveQpu backend.


Initialization

The following section outlines the default configurations of QuantumAnnealing. 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 QuantumAnnealing

algorithm = QuantumAnnealing(
    backend=None,
    anneal_offsets=None,
    anneal_schedule=None,
    annealing_time=None,
    auto_scale=None,
    fast_anneal=False,
    flux_biases=None,
    flux_drift_compensation=True,
    h_gain_schedule=None,
    initial_state=None,
    max_answers=None,
    num_reads=1,
    programming_thermalization=None,
    readout_thermalization=None,
    reduce_intersample_correlation=False,
    reinitialize_state=None
)

Parameter Details

For a complete overview of available parameters and their usage, see the QuantumAnnealing 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: QuantumAnnealingParams, LunaAlgorithm[DWaveQpu]

Quantum Annealing algorithm for physical quantum processors (QPUs).

Quantum Annealing is a metaheuristic that leverages quantum effects to find the ground state of a system, corresponding to the optimal solution of an optimization problem.

The process starts in a quantum superposition of all possible states, and gradually evolves the system according to a time-dependent Hamiltonian, exploiting quantum tunneling to potentially escape local minima more effectively than classical methods.

This implementation is specifically for D-Wave quantum annealers or similar hardware.

This class inherits all parameters from QuantumAnnealingParams, providing a complete set of controls for the quantum annealing process on hardware devices.

Attributes:

Name Type Description
anneal_offsets Any | None

Per-qubit time offsets for the annealing path. Default is None.

anneal_schedule Any | None

Custom schedule for the annealing process. Default is None.

annealing_time Any | None

Duration of the annealing process in microseconds. Default is None.

auto_scale Any | None

Whether to automatically normalize the problem energy range. Default is None.

fast_anneal bool

Use accelerated annealing protocol. Default is False.

flux_biases Any | None

Custom flux bias offsets for each qubit. Default is None.

flux_drift_compensation bool

Whether to compensate for drift in qubit flux over time. Default is True.

h_gain_schedule Any | None

Schedule for h-gain during annealing. Default is None.

initial_state Any | None

Starting state for the annealing process. Default is None.

max_answers int | None

Maximum number of unique answer states to return. Default is None.

num_reads int

Number of annealing cycles to perform. Default is 1.

programming_thermalization float | None

Wait time after programming the QPU. Default is None.

readout_thermalization float | None

Wait time after each anneal before reading results. Default is None.

reduce_intersample_correlation bool

Whether to add delay between samples. Default is False.

reinitialize_state bool | None

Whether to reset to a new initial state between reads. Default is None.

anneal_offsets class-attribute instance-attribute

anneal_offsets: list[float] | None = None

anneal_schedule class-attribute instance-attribute

anneal_schedule: list[tuple[float, float]] | None = None

annealing_time class-attribute instance-attribute

annealing_time: float | None = Field(default=None, gt=0)

auto_scale class-attribute instance-attribute

auto_scale: bool | None = None

backend class-attribute instance-attribute

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

fast_anneal class-attribute instance-attribute

fast_anneal: bool = False

flux_biases class-attribute instance-attribute

flux_biases: list[float] | None = None

flux_drift_compensation class-attribute instance-attribute

flux_drift_compensation: bool = True

h_gain_schedule class-attribute instance-attribute

h_gain_schedule: list[tuple[float, float]] | None = None

initial_state class-attribute instance-attribute

initial_state: list[int] | None = None

max_answers class-attribute instance-attribute

max_answers: int | None = Field(default=None, ge=1)

model_config class-attribute instance-attribute

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

num_reads class-attribute instance-attribute

num_reads: int = Field(default=1, ge=1)

programming_thermalization class-attribute instance-attribute

programming_thermalization: float | None = Field(default=None, gt=0)

readout_thermalization class-attribute instance-attribute

readout_thermalization: float | None = Field(default=None, gt=0)

reduce_intersample_correlation class-attribute instance-attribute

reduce_intersample_correlation: bool = False

reinitialize_state class-attribute instance-attribute

reinitialize_state: bool | 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.