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 = -0.5 * 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 waveform from a normalised parameter vector.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
6 values — 3 amplitude breakpoints then 3 detuning breakpoints, all normalised to [0, 1] (or [-1, 1] for detuning).
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 Bayesian optimisation.
| 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
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 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
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
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | |
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
Atom-register embedder using the qoolqit BLaDe (Block-Layout and Degree-based) matrix-embedding algorithm.
BLaDe jointly optimises atom positions to match the logical adjacency
structure of the QUBO graph with the physical Rydberg interaction matrix.
Configuration is taken from config.embedding (BLaDe-specific fields:
blade_steps_per_round, blade_starting_positions,
blade_dimensions, min_distance).
Source code in qubosolver/pipeline/embedder.py
embed()
Run the BLaDe embedding algorithm and return the resulting register.
Reads embedding hyper-parameters from self.config.embedding,
constructs a BladeConfig, runs Blade.embed on the QUBO
coefficient matrix, optionally rescales coordinates to satisfy the
min_distance constraint, and wraps the result as a Register.
See Qoolqit's documentation for details.
| RETURNS | DESCRIPTION |
|---|---|
Register
|
Atom register with positions optimised by BLaDe.
TYPE:
|
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
and returns a Register compatible with Pasqal/Pulser devices.
| ATTRIBUTE | DESCRIPTION |
|---|---|
instance |
The QUBO problem to embed.
TYPE:
|
config |
Solver configuration including embedding settings.
TYPE:
|
register |
The generated register (set after
TYPE:
|
backend |
The execution backend (used to access device specs).
TYPE:
|
Note
config.embedding.min_distance controls whether the generated register
is rescaled after embedding, and its correct value depends on the
drive-shaping method used:
-
Set to
1 + margin(e.g.1.001) when pairing with drive shapers that support theMAX_ENERGYqoolqit compiler profile (e.g.HeuristicDriveShaper). The compiler may rescale atom coordinates at compile time; providing a value just above 1 (in normalised units) ensures the register satisfies the minimum-distance constraint while leaving room for the compiler to adjust it freely. -
Set to
Nonewhen pairing with drive shapers that do not use theMAX_ENERGYprofile (e.g.OptimizedDriveShaper). In this case no rescaling is applied and the register coordinates are kept exactly as produced by the embedding algorithm, ready to be sent to the physical QPU as-is.
See Qoolqit's documentation for more details on rescaling:
| PARAMETER | DESCRIPTION |
|---|---|
instance
|
The QUBO problem to embed.
TYPE:
|
config
|
Solver configuration.
TYPE:
|
backend
|
Execution backend providing device information.
TYPE:
|
Source code in qubosolver/pipeline/embedder.py
embed()
abstractmethod
Create a register (atom layout) for the QUBO instance.
| 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. |