iqm.benchmarks.optimization.qscore.QScoreBenchmark#

class iqm.benchmarks.optimization.qscore.QScoreBenchmark(backend_arg: IQMBackendBase, configuration: QScoreConfiguration)#

Bases: Benchmark

Q-score estimates the size of combinatorial optimization problems a given number of qubits can execute with meaningful results.

Attributes

name

Methods

add_all_meta_to_dataset(dataset)

Adds all configuration metadata and circuits to the dataset variable

analysis_function(run)

Analysis function for a QScore experiment

choose_qubits_custom(num_qubits)

Choose the qubits to execute the circuits on, according to elements in custom_qubits_array matching num_qubits number of qubits

choose_qubits_naive(num_qubits)

Choose the qubits to execute the circuits on, sequentially starting at qubit 0.

execute(backend)

Executes the benchmark.

generate_maxcut_ansatz(graph, theta)

Generate an ansatz circuit for QAOA MaxCut, with measurements at the end.

Parameters:
static analysis_function(run: BenchmarkRunResult) BenchmarkAnalysisResult#

Analysis function for a QScore experiment

Parameters:

run (RunResult) – A QScore experiment run for which analysis result is created

Returns:

AnalysisResult corresponding to QScore

Return type:

BenchmarkAnalysisResult

generate_maxcut_ansatz(graph: Graph, theta: list[float]) QuantumCircuit#

Generate an ansatz circuit for QAOA MaxCut, with measurements at the end.

Parameters:
  • graph (networkx graph) – the MaxCut problem graph

  • theta (list[float]) – the variational parameters for QAOA, first gammas then betas

Returns:

the QAOA ansatz quantum circuit.

Return type:

QuantumCircuit

add_all_meta_to_dataset(dataset: Dataset)#

Adds all configuration metadata and circuits to the dataset variable

Parameters:

dataset (xr.Dataset) – The xarray dataset

static choose_qubits_naive(num_qubits: int) list[int]#

Choose the qubits to execute the circuits on, sequentially starting at qubit 0.

Parameters:

num_qubits (int) – the number of qubits to choose.

Returns:

the list of qubits to execute the circuits on.

Return type:

list[int]

choose_qubits_custom(num_qubits: int) list[int]#

Choose the qubits to execute the circuits on, according to elements in custom_qubits_array matching num_qubits number of qubits

Parameters:

num_qubits (int) – the number of qubits to choose

Returns:

the list of qubits to execute the circuits on

Return type:

list[int]

execute(backend: IQMBackendBase) Dataset#

Executes the benchmark.

Parameters:

backend (IQMBackendBase) –

Return type:

Dataset