bench_qubo

Contains core QPU-interaction code.

Implements the abstract interface bench_qubo.QUBOSolver, and the related “QPU solver classes” bench_qubo.QUBOSolverDwave and bench_qubo.QUBOSolverIBM, along with technical data preprocessing and access code in bench_qubo.DataBaseQUBO. Most notably, each device-specific class implements _run method that is used to submit a job to an actual device.

Relies on abstact descriptions from bench.DataBase and Solver.

Classes

DataBaseQUBO(directory[, file_ext, ...])

Implements QUBO instance storage.

QUBOSolver(name, db)

Describes an abstract QPU solver interface.

QUBOSolverDwave(db, token)

Implements D-Wave specific solver code.

QUBOSolverIBM(db)

Implements IBM-specific solver code.

class bench_qubo.DataBaseQUBO(directory, file_ext='.json', filter_fun=None, sort_fun=None, directory_embeddings=None)[source]

Implements QUBO instance storage.

_preprocess_qubo_data(Q, P, a, b)[source]
get_qubo_data(instance_id, a, b)[source]
get_embedding_data(instance_id, object_hook=None)[source]
class bench_qubo.QUBOSolver(name, db)[source]

Describes an abstract QPU solver interface.

abstract _run(instance_id, *args)[source]
get_data(instance_id, a, b)[source]
get_embedding_data(instance_id, object_hook=None)[source]
class bench_qubo.QUBOSolverDwave(db, token)[source]

Implements D-Wave specific solver code.

_load_embedding(instance_id)[source]

Loads precomputed D-Wave embeddings from a file.

_calculate_embedding(Q_dict, target_edgelist)[source]

Computes D-Wave embedding locally (and tracks the respective time for that).

_run(instance_id, num_reads, a, b)[source]
class bench_qubo.QUBOSolverIBM(db)[source]

Implements IBM-specific solver code.

_run_qpu_estimator(session, estimator_options, optimizer_name, optimizer_kwargs, optimizer_obj, optimizer_obj_kwargs, cost_func, ansatz, qubitOp, x0)[source]
_run_qpu_sampler(session, sampler_options, ansatz, res)[source]
_run(instance_id, optimizer_kwargs, optimizer_name, sampler_optimization_level, sampler_resilience_level, estimator_optimization_level, estimator_resilience_level, reps, sampler_shots, estimator_shots, backend_name, service_channel, service_instance, max_time, recover_on_exception, a, b)[source]