Configs
ClassicalConfig
Section titled “
ClassicalConfig
”
Bases: Config
A ClassicalConfig instance defines the classical
part of a SolverConfig.
| ATTRIBUTE | DESCRIPTION |
|---|---|
classical_solver_type |
Classical solver type. Defaults to "simulated_annealing_tabu_search".
TYPE:
|
cplex_maxtime |
CPLEX maximum runtime. Defaults to 600s.
TYPE:
|
cplex_log_path |
CPLEX log path. Default to
TYPE:
|
max_iter |
Maximum number of iterations to perform for simulated annealing or tabu search.
TYPE:
|
max_bitstrings |
Maximal number of bitstrings returned as solutions.
TYPE:
|
sa_initial_temp |
Starting temperature (controls exploration).
TYPE:
|
sa_final_temp |
Minimum temperature threshold for stopping.
TYPE:
|
sa_cooling_rate |
Cooling rate - should be slightly below 1 (e.g., 0.95–0.99).
TYPE:
|
sa_seed |
Random seed for reproducibility.
TYPE:
|
sa_start |
Optioanl initial bitstring of shape (n,).
TYPE:
|
sa_energy_tol |
Energy tolerance for considering two solutions as equivalent.
TYPE:
|
tabu_x0 |
The initial binary solution tensor of shape (n,).
TYPE:
|
tabu_tenure |
Number of iterations a move (bit flip) remains tabu.
TYPE:
|
tabu_max_no_improve |
Maximum number of consecutive iterations without improvement before termination.
TYPE:
|
Config
Section titled “
Config
”
Bases: BaseModel, ABC
Pydantic class for configs.
DecompositionConfig
Section titled “
DecompositionConfig
”
Bases: Config
The configuration parameters when using a decomposition method for solving large QUBO instances.
| ATTRIBUTE | DESCRIPTION |
|---|---|
decompose_threshold |
Threshold value for cost function used when searching to place a node/variable during decomposition.
TYPE:
|
decompose_stop_number |
Maximal number of nodes/variables left after the decomposition loop.
TYPE:
|
decompose_break_placement |
If a search iteration ends with very few nodes to place/variables on device, we stop iterating.
TYPE:
|
neglecting_inter_distance |
Value for neglecting interactions in the distance interaction matrix.
TYPE:
|
neglecting_max_coefficient |
Qubo coefficient from which we consider an interaction is neglecting.
TYPE:
|
DriveShapingConfig
Section titled “
DriveShapingConfig
”
Bases: Config
A DriveShapingConfig instance defines the drive shaping part of a SolverConfig.
| ATTRIBUTE | DESCRIPTION |
|---|---|
drive_shaping_method |
Drive shaping
method used. Defauts to
TYPE:
|
dmm |
Whether to use a detuning map when applying drive shaping or not. This adds WeightedDetuning with a Constant Waveform. Defaults to True, which applies DMM.
TYPE:
|
optimized_re_execute_opt_drive |
Whether to re-run the optimal drive sequence after optimization. Defaults to False.
TYPE:
|
optimized_n_calls |
Number of calls for the optimization process. Defaults to 20. Note the optimizer accepts a minimal value of 12.
TYPE:
|
optimized_initial_omega_parameters |
Default initial omega parameters for the drive. Defaults to Omega = (5, 10, 5).
TYPE:
|
optimized_initial_detuning_parameters |
Default initial detuning parameters for the drive. Defaults to delta = (-10, 0, 10).
TYPE:
|
optimized_custom_qubo_cost |
Apply a different
qubo cost evaluation
than the default QUBO evaluation defined in
TYPE:
|
optimized_custom_objective_fn |
For bayesian optimization, one can change the output of
TYPE:
|
optimized_callback_objective |
Apply a callback
during bayesian optimization. Only accepts one input dictionary
created during optimization
TYPE:
|
EmbeddingConfig
Section titled “
EmbeddingConfig
”
Bases: Config
A EmbeddingConfig instance defines the embedding
part of a SolverConfig.
| ATTRIBUTE | DESCRIPTION |
|---|---|
embedding_method |
The type of
embedding method used to place atoms on the register according to the QUBO problem.
Defaults to
TYPE:
|
greedy_layout |
Layout type for the
greedy embedder method. Defaults to
TYPE:
|
greedy_traps |
The number of traps on the register.
Defaults to
TYPE:
|
greedy_spacing |
The minimum distance between atoms.
Defaults to
TYPE:
|
greedy_density |
The estimated density of the QUBO matrix. Defaults to None.
TYPE:
|
blade_steps_per_round |
The number of steps for each layer of dimension for BLaDE. Defaults to 200.
TYPE:
|
blade_starting_positions |
The starting parameters according to the specified dimensions. Defaults to None.
TYPE:
|
blade_dimensions |
A list of dimension degrees
to explore one after the other (default is
TYPE:
|
draw_steps |
Show generated graph at each step of the optimization.
Defaults to
TYPE:
|
animation_save_path |
If provided, path to save animation. Defaults to None.
TYPE:
|
SolverConfig
Section titled “
SolverConfig
”
Bases: Config
A SolverConfig instance defines how a QUBO problem should be solved.
We specify whether to use a quantum or classical approach,
which backend to run on, and additional execution parameters.
| ATTRIBUTE | DESCRIPTION |
|---|---|
config_name |
The name of the current configuration. Defaults to ''.
TYPE:
|
use_quantum |
Whether to solve using a quantum approach (
TYPE:
|
embedding |
Embedding part configuration of the solver.
TYPE:
|
drive_shaping |
Drive-shaping part configuration of the solver.
TYPE:
|
classical |
Classical part configuration of the solver.
TYPE:
|
backend |
backend
for running quantum programs. Note that parameters
such as
TYPE:
|
device |
The quantum device specification. Defaults to
TYPE:
|
do_postprocessing |
Whether we apply post-processing (
TYPE:
|
do_preprocessing |
Whether we apply pre-processing (
TYPE:
|
activate_trivial_solutions |
Whether calculate trivial solutions (
TYPE:
|
decompose |
which decomposition configuration to use when solving large QUBOs. Defaults to None, i.e. no decomposition is applied.
TYPE:
|
from_kwargs(**kwargs)
classmethod
Section titled “
from_kwargs(**kwargs)
classmethod
”Create an instance based on entries of other configs.
Note that if any of the keywords ("embedding", "drive_shaping", "classical") are present in kwargs, the values are taken directly.
| RETURNS | DESCRIPTION |
|---|---|
SolverConfig
|
An instance from values.
TYPE:
|
Source code in qubosolver/config.py
@classmethoddef from_kwargs(cls, **kwargs: dict) -> SolverConfig: """Create an instance based on entries of other configs.
Note that if any of the keywords ("embedding", "drive_shaping", "classical") are present in kwargs, the values are taken directly.
Returns: SolverConfig: An instance from values. """ # Extract fields from pydantic BaseModel embedding_fields = {k: v for k, v in kwargs.items() if k in EmbeddingConfig.model_fields} drive_shaping_fields = { k: v for k, v in kwargs.items() if k in DriveShapingConfig.model_fields } classical_fields = {k: v for k, v in kwargs.items() if k in ClassicalConfig.model_fields} decompose_fields = { k: v for k, v in kwargs.items() if k in DecompositionConfig.model_fields }
solver_fields = { k: v for k, v in kwargs.items() if k in cls.model_fields and k not in ("embedding", "drive_shaping", "classical", "decompose") }
decompose = kwargs["decompose"] if "decompose" in kwargs else None if decompose_fields: decompose = DecompositionConfig(**decompose_fields)
return cls( embedding=( EmbeddingConfig(**embedding_fields) if "embedding" not in kwargs else kwargs["embedding"] ), drive_shaping=( DriveShapingConfig(**drive_shaping_fields) if "drive_shaping" not in kwargs else kwargs["drive_shaping"] ), classical=( ClassicalConfig(**classical_fields) if "classical" not in kwargs else kwargs["classical"] ), decompose=decompose, **solver_fields, )
print_specs()
Section titled “
print_specs()
”Print specs.
Source code in qubosolver/config.py
def print_specs(self) -> None: """Print specs.""" print(self.specs())
specs()
Section titled “
specs()
”Return the specs of the SolverConfig, that is all attributes.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Dictionary of specs key-values.
TYPE:
|
Source code in qubosolver/config.py
def specs(self) -> str: """Return the specs of the `SolverConfig`, that is all attributes.
Returns: dict: Dictionary of specs key-values. """ return "\n".join( f"{k}: ''" if v == "" else f"{k}: {v}" for k, v in self.model_dump().items() )