RepeatedReverseQuantumAnnealing¶
Repeated Reverse Quantum Annealing begins the annealing process from a previously initialized state and increases the temperature from there. Afterwards, the temperature is decreased again until the solution is found. This procedure is repeated several times with this particular solver. (for additional information see: D-Wave Reverse Annealing)
Note
This solver is only available for commercial and academic licenses.
Compatible Backends¶
The RepeatedReverseQuantumAnnealing
algorithm supports the following backends:
By default, RepeatedReverseQuantumAnnealing
uses the DWaveQpu
backend.
Initialization¶
The following section outlines the default configurations of RepeatedReverseQuantumAnnealing
. 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.
from luna_quantum.solve.parameters.algorithms import RepeatedReverseQuantumAnnealing
algorithm = RepeatedReverseQuantumAnnealing(
backend=None,
anneal_offsets=None,
annealing_time=None,
auto_scale=None,
flux_biases=None,
flux_drift_compensation=True,
h_gain_schedule=None,
max_answers=None,
programming_thermalization=None,
readout_thermalization=None,
reduce_intersample_correlation=False,
initial_states=None,
n_initial_states=1,
samples_per_state=1,
beta_schedule=[0.5, 3],
timeout=300,
max_iter=10,
target=None,
check_trivial=True
)
Parameter Details
For a complete overview of available parameters and their usage, see the RepeatedReverseQuantumAnnealing 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]
Parameters for the Repeated Reverse Quantum Annealing algorithm.
This approach combines reverse annealing (starting from a classical state) with repetition to refine solutions iteratively. It's particularly useful for: 1. Local refinement of solutions found by classical methods 2. Escaping local minima by temporarily increasing quantum fluctuations 3. Improving solutions through multiple rounds of quantum optimization
The process involves: - Starting with classical initial states - Partially "unsolving" them by increasing quantum fluctuations - Re-annealing to find potentially better nearby solutions - Repeating with the best solutions found
Attributes:
Name | Type | Description |
---|---|---|
anneal_offsets |
Any | None
|
Per-qubit time offsets for the annealing path, allowing qubits to anneal at different rates. Useful for problems with varying energy scales or when certain qubits need different annealing trajectories. Default is None, which uses standard annealing for all qubits. |
annealing_time |
Any | None
|
Duration of the annealing process in microseconds. Longer times can improve solution quality for problems with small energy gaps but increase runtime. Default is None, which uses the QPU's default annealing time. |
auto_scale |
Any | None
|
Whether to automatically normalize the problem energy range to match hardware capabilities, preventing precision issues in the physical implementation. Default is None, which uses the D-Wave system's default setting. |
flux_biases |
Any | None
|
Custom flux bias offsets for each qubit to compensate for manufacturing variations in the QPU hardware or to intentionally bias certain qubits. Default is None, using standard calibration values. |
flux_drift_compensation |
bool
|
Whether to compensate for drift in qubit flux over time, improving the reliability and consistency of results across multiple runs. Default is True, which is recommended for most applications. |
h_gain_schedule |
Any | None
|
Schedule for h-gain (linear coefficient strength) during annealing, allowing dynamic adjustment of problem coefficients throughout the process. Default is None, using standard gain settings. |
max_answers |
int | None
|
Maximum number of unique answer states to return from the quantum hardware. Useful for collecting diverse solutions while filtering out duplicates. Must be greater than or equal to 1 if specified. Default is None, which returns all unique solutions found. |
programming_thermalization |
float | None
|
Wait time (in microseconds) after programming the QPU, allowing it to reach thermal equilibrium before starting the annealing process. Must be positive if specified. Default is None, using system default. |
readout_thermalization |
float | None
|
Wait time (in microseconds) after each anneal before reading results. Helps ensure the qubits have settled into their final states before measurement. Must be positive if specified. Default is None, using system default. |
reduce_intersample_correlation |
bool
|
Whether to add delay between samples to reduce temporal correlations that might bias results across multiple runs. Default is False to minimize runtime, but can be set to True when sample independence is critical. |
initial_states |
list[dict[str, int]] | None
|
Initial classical states to start the reverse annealing from, specified as
dictionaries mapping variable names to binary values (0 or 1). For each state,
one call to the sampler with parameter |
n_initial_states |
int
|
Number of initial states to create when |
samples_per_state |
int
|
How many samples to create per state in each iteration after the first. More samples increase the chance of finding improvements but use more QPU time. Controls the breadth of exploration around each promising solution. Default is 1. Must be ≥1. |
beta_schedule |
list[float]
|
Beta schedule controlling the quantum fluctuation strength during reverse annealing. Beta is the inverse temperature (1/T), with lower values allowing more thermal excitation to explore the energy landscape more widely. Default [0.5, 3] provides moderate initial fluctuation followed by cooling, balancing exploration and exploitation. |
timeout |
float
|
Maximum runtime in seconds before the solver stops, regardless of convergence. Provides a hard time limit to ensure the algorithm completes within a reasonable timeframe. Default is 300 seconds (5 minutes), balancing solution quality with timeliness. |
max_iter |
int
|
Maximum number of iterations (reverse annealing cycles) to perform. Each iteration refines the solutions from the previous round, potentially discovering better solutions in the neighborhood of good candidates. Default is 10, providing good refinement without excessive QPU usage. |
target |
Any | None
|
Target energy value that, if reached, causes the algorithm to terminate early. Allows for early stopping when a sufficiently good solution is found. Default is None (run until other stopping criteria are met). |
check_trivial |
bool
|
Whether to check for and handle trivial variables (those without interactions) before sending the problem to the QPU. Adds some computational overhead but prevents potential runtime errors and improves embedding efficiency. Default is True, which is recommended for robust operation. |
backend
class-attribute
instance-attribute
¶
beta_schedule
class-attribute
instance-attribute
¶
initial_states
class-attribute
instance-attribute
¶
max_answers
class-attribute
instance-attribute
¶
model_config
class-attribute
instance-attribute
¶
n_initial_states
class-attribute
instance-attribute
¶
programming_thermalization
class-attribute
instance-attribute
¶
readout_thermalization
class-attribute
instance-attribute
¶
reduce_intersample_correlation
class-attribute
instance-attribute
¶
samples_per_state
class-attribute
instance-attribute
¶
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. |