Quantum-related components of a QUBO solver
Drive Shapping
AdiabaticDriveShaper(instance, config, backend)
Bases: BaseDriveShaper
A Standard Adiabatic Drive shaper.
Source code in qubosolver/pipeline/drive.py
generate(register)
Generate an adiabatic drive based on the QUBO instance and physical register.
| PARAMETER | DESCRIPTION |
|---|---|
register
|
The physical register layout for the quantum system.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Drive, QUBOSolution]
|
tuple[Drive, QUBOSolution | None]: - Drive: A generated Drive object. - QUBOSolution: An instance of the qubo solution - str | None: The bitstring (solution) -> Not computed - float | None: The cost (energy value) -> Not computed - float | None: The probabilities for each bitstring -> Not computed - float | None: The counts of each bitstring -> Not computed |
Source code in qubosolver/pipeline/drive.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
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
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
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
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. |