Quantum-related components of a QUBO solver
Pulse Shapping
AdiabaticPulseShaper(instance, config, backend)
Bases: BasePulseShaper
A Standard Adiabatic Pulse shaper.
Source code in qubosolver/pipeline/pulse.py
generate(register, instance)
Generate an adiabatic pulse based on the QUBO instance and physical register.
PARAMETER | DESCRIPTION |
---|---|
register
|
The physical register layout for the quantum system.
TYPE:
|
instance
|
The QUBO instance.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[Pulse, QUBOSolution]
|
tuple[Pulse, QUBOSolution | None]: - Pulse: A generated pulse object wrapping a Pulser pulse. - 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/pulse.py
BasePulseShaper(instance, config, backend)
Bases: ABC
Abstract base class for generating pulse schedules based on a QUBO problem.
This class transforms the structure of a QUBOInstance into a quantum pulse sequence that can be applied to a physical register. The register is passed at the time of pulse generation, not during initialization.
ATTRIBUTE | DESCRIPTION |
---|---|
instance |
The QUBO problem instance.
TYPE:
|
config |
The solver configuration.
TYPE:
|
pulse |
A saved current pulse obtained by
TYPE:
|
backend |
Backend to use.
TYPE:
|
device |
Device from backend.
TYPE:
|
Initialize the pulse 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/pulse.py
generate(register, instance)
abstractmethod
Generate a pulse based on the problem and the provided register.
PARAMETER | DESCRIPTION |
---|---|
register
|
The physical register layout.
TYPE:
|
instance
|
The QUBO instance.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Pulse
|
A generated pulse object wrapping a Pulser pulse.
TYPE:
|
QUBOSolution
|
An instance of the qubo solution
TYPE:
|
Source code in qubosolver/pipeline/pulse.py
OptimizedPulseShaper(instance, config, backend)
Bases: BasePulseShaper
Pulse shaper that uses optimization to find the best pulse parameters for solving QUBOs. Returns an optimized pulse, the bitstrings, their counts, probabilities, and costs.
ATTRIBUTE | DESCRIPTION |
---|---|
pulse |
current pulse.
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:
|
custom_qubo_cost |
Apply a different qubo cost evaluation during optimization.
Must be defined as:
TYPE:
|
custom_objective_fn |
For bayesian optimization, one can change the output of
TYPE:
|
callback_objective |
Apply a callback
during bayesian optimization. Only accepts one input dictionary
created during optimization
TYPE:
|
Instantiate an OptimizedPulseShaper
.
PARAMETER | DESCRIPTION |
---|---|
instance
|
Qubo instance.
TYPE:
|
config
|
Configuration for solving.
TYPE:
|
backend
|
Backend to use during optimization.
TYPE:
|
Source code in qubosolver/pipeline/pulse.py
build_pulse(params)
Build the pulse from a list of parameters for the objective.
PARAMETER | DESCRIPTION |
---|---|
params
|
List of parameters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Pulse
|
pulse sequence.
TYPE:
|
Source code in qubosolver/pipeline/pulse.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/pulse.py
generate(register, instance)
Generate a pulse via optimization.
PARAMETER | DESCRIPTION |
---|---|
register
|
The physical register layout.
TYPE:
|
instance
|
The QUBO instance.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Pulse
|
A generated pulse object wrapping a Pulser pulse.
TYPE:
|
QUBOSolution
|
An instance of the qubo solution
TYPE:
|
Source code in qubosolver/pipeline/pulse.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
run_simulation(register, pulse, 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:
|
pulse
|
pulse sequence 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/pulse.py
get_pulse_shaper(instance, config, backend)
Method that returns the correct PulseShaper based on configuration. The correct pulse shaping method can be identified using the config, and an object of this pulseshaper 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 pulse shaping.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
BasePulseShaper
|
The representative Pulse Shaper object. |
Source code in qubosolver/pipeline/pulse.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. |