DWaveQpu Backend¶
The DWaveQpu
backend class provides configuration and interface support for submitting problems to D-Wave's quantum processing units (QPUs). It encapsulates the necessary settings for both classical preprocessing (e.g., problem decomposition) and quantum-specific configuration such as minor-embedding and chain strength tuning.
Using Environment Variables
You can set your D-Wave token via environment variables to avoid passing them during initialization:
Initialization¶
Initialize the DWaveQpu
backend with:
from luna_quantum.solve.parameters.backends import DWaveQpu
backend = DWaveQpu(
embedding_parameters=None,
qpu_backend='default',
token=None
)
API-Reference¶
DWaveQpu ¶
Bases: DWave
, QpuTokenBackend
Configuration for D-Wave quantum processing backends.
This class provides settings for problem decomposition and embedding when using D-Wave quantum processors. It can be configured to use either manual embedding parameters or automatic embedding based on problem characteristics.
Attributes:
Name | Type | Description |
---|---|---|
embedding_parameters |
Embedding | None, default=None
|
Detailed configuration for manual embedding when not using auto-embedding. If None and decomposer is also None, default embedding parameters will be used. Ignored if decomposer is set to AutoEmbedding. |
qpu_backend |
str
|
Specific D-Wave quantum processing unit (QPU) for your optimization |
embedding_parameters
class-attribute
instance-attribute
¶
embedding_parameters: Embedding | AutoEmbedding | None = None
provider
property
¶
Retrieve the name of the provider.
Returns:
Type | Description |
---|---|
str
|
The name of the provider. |
qpu_backend
class-attribute
instance-attribute
¶
token
class-attribute
instance-attribute
¶
AutoEmbedding ¶
Bases: BaseModel
Configuration for automatic embedding of problems onto D-Wave hardware.
This class provides a simpler interface to configure the embedding process when the details of the underlying hardware are not known or when optimal embedding parameters should be determined automatically.
Attributes:
Name | Type | Description |
---|---|---|
embedding_parameters |
EmbeddingParameters, default=EmbeddingParameters()
|
Detailed configuration parameters for the embedding algorithm. See EmbeddingParameters documentation for details on specific settings. |
Embedding ¶
Bases: BaseModel
Configuration parameters for embedding problems onto D-Wave QPUs.
Embedding maps logical variables from a problem to physical qubits on the QPU, with chains of qubits representing individual variables.
Attributes:
Name | Type | Description |
---|---|---|
max_no_improvement |
int, default=10
|
Maximum number of consecutive failed iterations to improve the current solution before giving up. Each iteration attempts to find an embedding for each variable such that it is adjacent to all its neighbors. |
random_seed |
Optional[int], default=None
|
Seed for the random number generator. If None, seed is set by
|
timeout |
int, default=1000
|
Maximum time in seconds before the algorithm gives up. |
max_beta |
Optional[float], default=None
|
Controls qubit weight assignment using formula (beta^n) where n is the
number of chains containing that qubit. Must be greater than 1 if specified.
If None, |
tries |
int, default=10
|
Number of restart attempts before the algorithm stops. On D-Wave 2000Q, a typical restart takes between 1 and 60 seconds. |
inner_rounds |
Optional[int], default=None
|
Maximum iterations between restart attempts. Restart attempts are typically
terminated due to |
chainlength_patience |
int, default=10
|
Maximum number of consecutive failed iterations to improve chain lengths before moving on. Each iteration attempts to find more efficient embeddings. |
max_fill |
Optional[int], default=None
|
Restricts the number of chains that can simultaneously use the same qubit during search. Values above 63 are treated as 63. If None, effectively infinite. |
threads |
int, default=1
|
Maximum number of threads to use. Parallelization is only advantageous when the expected variable degree significantly exceeds the thread count. Min: 1. |
return_overlap |
bool, default=False
|
Controls return value format: - True: Returns (embedding, validity_flag) tuple - False: Returns only the embedding This function returns an embedding regardless of whether qubits are used by multiple variables. |
skip_initialization |
bool, default=False
|
If True, skips the initialization pass. Only works with semi-valid
embeddings provided through |
initial_chains |
Any, default=()
|
Initial chains inserted before |
fixed_chains |
Any, default=()
|
Fixed chains that cannot change during the algorithm. Qubits in these chains are not used by other chains. Missing or empty entries are ignored. Each value is a list of qubit labels. |
restrict_chains |
Any, default=()
|
Restricts each chain[i] to be a subset of |
suspend_chains |
Any, default=()
|
A metafeature only implemented in the Python interface. For each suspended
variable i, |
get_qpu_tokens ¶
Retrieve a QPU token.
This method is intended to be implemented by subclasses to provide the
mechanism for fetching the required Quantum Processing Unit (QPU) tokens, if
they are required by the solver implementation. The tokens may either be
sourced from a TokenProvider
object or result in a None
if unavailable.
Returns:
Type | Description |
---|---|
TokenProvider | None:
|
An object implementing the |