qrisp.vqe.VQEBenchmark.visualize#
- VQEBenchmark.visualize(cost_metric='oqv', gain_metric='approx_ratio')[source]#
Plots the results of
.evaluate
.- Parameters:
- cost_metricstr or callable, optional
The method to evaluate the cost of each run. The default is “oqv”.
- gain_metricstr or callable, optional
The method to evaluate the gain of each run. The default is “approx_ratio”.
Examples
We create a Heisenberg problem instance and benchmark several parameters:
from qrisp import QuantumVariable from qrisp.vqe.problems.heisenberg import * from networkx import Graph G = Graph() G.add_edges_from([(0,1),(1,2),(2,3),(3,4)]) vqe = heisenberg_problem(G,1,0) H = create_heisenberg_hamiltonian(G,1,0) benchmark_data = vqe.benchmark(qarg = QuantumVariable(5), depth_range = [1,2,3], precision_range = [0.02,0.01], iter_range = [25,50], optimal_energy = H.ground_state_energy(), repetitions = 2 )
To visualize the results, we call the corresponding method.
benchmark_data.visualize()