Quantum-related components of a QUBO solver
Drive Shapping
BaseDriveShaper(instance, config, backend)
Bases: ABC
Abstract base class for generating Qoolqit drives based on a QUBO problem.
This class transforms the structure of a QUBOInstance into a quantum waveform sequence or drive that can be applied to a physical register. The register is passed at the time of drive generation, not during initialization.
| ATTRIBUTE | DESCRIPTION |
|---|---|
instance |
The QUBO problem instance.
TYPE:
|
config |
The solver configuration.
TYPE:
|
drive |
A saved current drive obtained by
TYPE:
|
backend |
Backend to use.
TYPE:
|
device |
Device from backend.
TYPE:
|
Initialize the drive shaping module with a QUBO instance.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The QUBO problem instance.
TYPE:
|
config
|
The solver configuration.
TYPE:
|
backend
|
Backend to use.
TYPE:
|
Source code in qubosolver/pipeline/drive.py
generate(register)
abstractmethod
Generate a drive based on the problem and the provided register.
| PARAMETER | DESCRIPTION |
|---|---|
register
|
The physical register layout.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Drive
|
A generated Drive.
TYPE:
|
QUBOSolution
|
An instance of the qubo solution
TYPE:
|
Source code in qubosolver/pipeline/drive.py
HeuristicDriveShaper(instance, config, backend)
Bases: BaseDriveShaper
Heuristic schedule drive shaper.
With DMM
Final target encoding: d_i = -alpha * Q_ii
DMM convention in this stack: WeightedDetuning waveform must be <= 0
Hence we encode the local final detuning as: delta_i(T) = delta_g(T) + delta_dmm(T) * w_i
with: delta_g(T) = d_max delta_dmm(T) = -(d_max - d_min) <= 0 w_i = (d_max - d_i) / (d_max - d_min) in [0, 1]
so that: delta_i(T) = d_i
Without DMM
Only a global detuning is available, so the final detuning is chosen as: delta_g(T) = mean(d_i) and no weighted detunings are declared.
Source code in qubosolver/pipeline/drive.py
OptimizedDriveShaper(instance, config, backend)
Bases: BaseDriveShaper
Drive shaper that uses optimization to find the best drive parameters for solving QUBOs. Returns an optimized drive, the bitstrings, their counts, probabilities, and costs.
| ATTRIBUTE | DESCRIPTION |
|---|---|
drive |
current drive.
TYPE:
|
best_cost |
Current best cost.
TYPE:
|
best_bitstring |
Current best bitstring.
TYPE:
|
bitstrings |
List of current bitstrings obtained.
TYPE:
|
counts |
Frequencies of bitstrings.
TYPE:
|
probabilities |
Probabilities of bitstrings.
TYPE:
|
costs |
Qubo cost.
TYPE:
|
optimized_custom_qubo_cost |
Apply a different qubo cost evaluation during optimization.
Must be defined as:
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:
|
Instantiate an OptimizedDriveShaper.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
Qubo instance.
TYPE:
|
config
|
Configuration for solving.
TYPE:
|
backend
|
Backend to use during optimization.
TYPE:
|
Source code in qubosolver/pipeline/drive.py
build_drive(params)
Build the drive from a list of parameters for the objective.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
List of parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Drive
|
Drive sequence.
TYPE:
|
Source code in qubosolver/pipeline/drive.py
compute_qubo_cost(bitstring, QUBO)
The qubo cost for a single bitstring to apply during optimization.
| PARAMETER | DESCRIPTION |
|---|---|
bitstring
|
candidate bitstring.
TYPE:
|
QUBO
|
qubo coefficients.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
respective cost of bitstring.
TYPE:
|
Source code in qubosolver/pipeline/drive.py
generate(register)
Generate a drive via optimization.
| PARAMETER | DESCRIPTION |
|---|---|
register
|
The physical register layout.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Drive
|
A generated Drive.
TYPE:
|
QUBOSolution
|
An instance of the qubo solution
TYPE:
|
Source code in qubosolver/pipeline/drive.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
run_simulation(register, drive, QUBO, convert_to_tensor=True)
Run a quantum program using backend and returns a tuple of (bitstrings, counts, probabilities, costs, best cost, best bitstring).
| PARAMETER | DESCRIPTION |
|---|---|
register
|
register of quantum program.
TYPE:
|
drive
|
drive to run on backend.
TYPE:
|
QUBO
|
Qubo coefficients.
TYPE:
|
convert_to_tensor
|
Convert tuple components to tensors. Defaults to True.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple
|
tuple of (bitstrings, counts, probabilities, costs, best cost, best bitstring)
TYPE:
|
Source code in qubosolver/pipeline/drive.py
get_drive_shaper(instance, config, backend)
Method that returns the correct DriveShaper based on configuration. The correct drive shaping method can be identified using the config, and an object of this driveshaper can be returned using this function.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The QUBO problem to embed.
TYPE:
|
config
|
The solver configuration used.
TYPE:
|
backend
|
Backend to extract device from or to use during drive shaping.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BaseDriveShaper
|
The representative Drive Shaper object. |
Source code in qubosolver/pipeline/drive.py
Embedding
BLaDEmbedder(instance, config, backend)
Bases: BaseEmbedder
BLaDE (Balanced Latently Dimensional Embedder)
Computes positions for nodes so that their interactions according to a device approach the desired values at best. The result can be used as an embedding. Its prior target is on interaction matrices or QUBOs, but it can also be used for MIS with limitations if the adjacency matrix is converted into a QUBO. The general principle is based on the Fruchterman-Reingold algorithm.
Source code in qubosolver/pipeline/embedder.py
BaseEmbedder(instance, config, backend)
Bases: ABC
Abstract base class for all embedders.
Prepares the geometry (register) of atoms based on the QUBO instance. Returns a Register compatible with Pasqal/Pulser devices.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The QUBO problem to embed.
TYPE:
|
config
|
The Solver Configuration.
TYPE:
|
Source code in qubosolver/pipeline/embedder.py
embed()
abstractmethod
Creates a layout of atoms as the register.
| RETURNS | DESCRIPTION |
|---|---|
Register
|
The register.
TYPE:
|
GreedyEmbedder(instance, config, backend)
Bases: BaseEmbedder
Create an embedding in a greedy fashion.
At each step, place one logical node onto one trap to minimize the incremental mismatch between the logical QUBO matrix Q and the physical interaction matrix U (approx. C / ||r_i - r_j||^6).
Source code in qubosolver/pipeline/embedder.py
embed()
Creates a layout of atoms as the register.
| RETURNS | DESCRIPTION |
|---|---|
Register
|
The register.
TYPE:
|
Source code in qubosolver/pipeline/embedder.py
get_embedder(instance, config, backend)
Method that returns the correct embedder based on configuration. The correct embedding method can be identified using the config, and an object of this embedding can be returned using this function.
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The QUBO problem to embed.
TYPE:
|
config
|
The quantum device to target.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BaseEmbedder
|
The representative embedder object. |