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 problem that can be solved.

Attributes

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 custom_qubits_array matching num_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[, rzz_list])

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

generate_maxcut_ansatz_star(graph, theta[, ...])

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

greedy_vertex_cover_with_mapping(mapping_graph)

Approximate a minimum vertex cover for a given graph, providing a mapping of nodes to the edges they cover.

name()

Returns the name of the benchmark.

Parameters:
static analysis_function(run: BenchmarkRunResult) BenchmarkAnalysisResult#

Analysis function for a QScore experiment.

Parameters:

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

Returns:

AnalysisResult corresponding to QScore

Return type:

BenchmarkAnalysisResult

classmethod name() str#

Returns the name of the benchmark.

Return type:

str

greedy_vertex_cover_with_mapping(mapping_graph: Graph) dict[int, list[int]]#

Approximate a minimum vertex cover for a given graph, providing a mapping of nodes to the edges they cover.

Parameters:

mapping_graph (Graph) – The input graph for which the vertex cover is to be computed.

Returns:

A dictionary where keys are nodes and values are lists of edges that each node covers.

Return type:

dict[int, list[int]]

generate_maxcut_ansatz_star(graph: Graph, theta: list[float], qubit_set: list[int] | None = None) QuantumCircuit#

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

Parameters:
  • graph (Graph) – The MaxCut problem graph

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

  • qubit_set (list[int] | None) – The qubit set to be used for the ansatz

Returns:

The QAOA ansatz quantum circuit.

Return type:

QuantumCircuit

generate_maxcut_ansatz(graph: Graph, theta: list[float], rzz_list: list[tuple[int, int]] | None = None) QuantumCircuit#

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

Parameters:
  • graph (Graph) – The MaxCut problem graph

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

  • rzz_list (list[tuple[int, int]] | None) – List of RZZ gates grouped for optimal execution

Returns:

The QAOA ansatz quantum circuit.

Return type:

QuantumCircuit

add_all_meta_to_dataset(dataset: Dataset) None#

Adds all configuration metadata and circuits to the dataset variable.

Parameters:

dataset (Dataset) – The xarray dataset

Return type:

None

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 custom_qubits_array matching num_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