Quantum approximate optimization algorithm
Usage estimate: 22 minutes on a Heron r3 processor (NOTE: This is an estimate only. Your runtime might vary.)
Background
This tutorial demonstrates how to implement theQuantum Approximate Optimization Algorithm (QAOA) – a hybrid (quantum-classical) iterative method – within the context of Qiskit patterns. You will first solve theMaximum-Cut (orMax-Cut) problem for a small graph and then learn how to execute it at utility scale. All the hardware executions in the tutorial should run within the time limit for the freely-accessible Open Plan.
The Max-Cut problem is an optimization problem that is hard to solve (more specifically, it is anNP-hard problem) with a number of different applications in clustering, network science, and statistical physics. This tutorial considers a graph of nodes connected by edges, and aims to partition it into separate graphs such that they are both as large as possible. Put another way, the goal of this problem is to partition the nodes of a graph into two sets such that the number of edges traversed by this cut is maximized.

Requirements
Before starting this tutorial, be sure you have the following installed:
- Qiskit SDK v1.0 or later, with visualization support (
pip install 'qiskit[visualization]') - Qiskit Runtime 0.22 or later (
pip install qiskit-ibm-runtime)
Setup
import matplotlibimport matplotlib.pyplotas pltimport rustworkxas rxfrom rustworkx.visualizationimport mpl_drawas draw_graphimport numpyas npfrom scipy.optimizeimport minimizefrom collectionsimport defaultdictfrom typingimport Sequencefrom qiskit.quantum_infoimport SparsePauliOpfrom qiskit.circuit.libraryimport QAOAAnsatzfrom qiskit.transpiler.preset_passmanagersimport generate_preset_pass_managerfrom qiskit_ibm_runtimeimport QiskitRuntimeServicefrom qiskit_ibm_runtimeimport Session, EstimatorV2as Estimatorfrom qiskit_ibm_runtimeimport SamplerV2as SamplerPart I. Small-scale QAOA
The first part of this tutorial uses a small-scale Max-Cut problem to illustrate the steps to solve an optimization problem using a quantum computer.
To give some context before mapping this problem to a quantum algorithm, you can better understand how the Max-Cut problem becomes a classical combinatorial optimization problem by first considering the minimization of a function
where the input is a vector whose components correspond to each node of a graph. Then, constrain each of these components to be either or (which represent being included or not included in the cut). This small-scale example case uses a graph with nodes.
You could write a function of a pair of nodes which indicates whether the corresponding edge is in the cut. For example, the function is 1 only if one of either or are 1 (which means that the edge is in the cut) and zero otherwise. The problem of maximizing the edges in the cut can be formulated as
which can be rewritten as a minimization of the form
The minimum of in this case is when the number of edges traversed by the cut is maximal. As you can see, there is nothing relating to quantum computing yet. You need to reformulate this problem into something that a quantum computer can understand.
Initialize your problem by creating a graph with nodes.
n=5graph= rx.PyGraph()graph.add_nodes_from(np.arange(0, n,1))edge_list= [ (0,1,1.0), (0,2,1.0), (0,4,1.0), (1,2,1.0), (2,3,1.0), (3,4,1.0),]graph.add_edges_from(edge_list)draw_graph(graph, node_size=600, with_labels=True)Output:

Step 1: Map classical inputs to a quantum problem
The first step of the pattern is to map the classical problem (graph) into quantumcircuits andoperators. To do this, there are three main steps to take:
- Utilize a series of mathematical reformulations, to represent this problem using the Quadratic Unconstrained Binary Optimization (QUBO) problems notation.
- Rewrite the optimization problem as a Hamiltonian for which the ground state corresponds to the solution which minimizes the cost function.
- Create a quantum circuit which will prepare the ground state of this Hamiltonian via a process similar to quantum annealing.
Note: In the QAOA methodology, you ultimately want to have an operator (Hamiltonian) that represents thecost function of our hybrid algorithm, as well as a parametrized circuit (Ansatz) that represents quantum states with candidate solutions to the problem. You can sample from these candidate states and then evaluate them using the cost function.
Graph → optimization problem
The first step of the mapping is a notation change, The following expresses the problem in QUBO notation:
where is a matrix of real numbers, corresponds to the number of nodes in your graph, is the vector of binary variables introduced above, and indicates the transpose of the vector.
Maximize -2*x_0*x_1 - 2*x_0*x_2 - 2*x_0*x_4 - 2*x_1*x_2 - 2*x_2*x_3 - 2*x_3*x_4 + 3*x_0 + 2*x_1 + 3*x_2 + 2*x_3 + 2*x_4Subject to No constraints Binary variables (5) x_0 x_1 x_2 x_3 x_4Optimization problem → Hamiltonian
You can then reformulate the QUBO problem as aHamiltonian (here, a matrix that represents the energy of a system):
Reformulation steps from the QAOA problem to the Hamiltonian
Reformulation steps from the QAOA problem to the Hamiltonian
To demonstrate how the QAOA problem can be rewritten in this way, first replace the binary variables to a new set of variables via
Here you can see that if is, then must be. When the's are substituted for the's in the optimization problem (), an equivalent formulation can be obtained.
Now if we define, remove the prefactor, and the constant term, we arrive at the two equivalent formulations of the same optimization problem.
Here, depends on. Note that to obtain we dropped the factor of 1/4 and a constant offset of which do not play a role in the optimization.
Now, to obtain a quantum formulation of the problem, promote the variables to a Pauli matrix, such as a matrix of the form
When you substitute these matrices in the optimization problem above, you obtain the following Hamiltonian
Also recall that the matrices are embedded in the quantum computer's computational space, that is, a Hilbert space of size. Therefore, you should understand terms such as as the tensor product embedded in the Hilbert space. For example, in a problem with five decision variables the term is understood to mean where is the identity matrix.
This Hamiltonian is called thecost function Hamiltonian. It has the property that its ground state corresponds to the solution thatminimizes the cost function.Therefore, to solve your optimization problem you now need to prepare the ground state of (or a state with a high overlap with it) on the quantum computer. Then, sampling from this state will, with a high probability, yield the solution to.
Now let us consider the Hamiltonian for theMax-Cut problem. Let each vertex of the graph be associated with a qubit in state or, where the value denotes the set the vertex is in. The goal of the problem is to maximize the number of edges for which and, or vice-versa. If we associate the operator with each qubit, where
then an edge belongs to the cut if the eigenvalue of; in other words, the qubits associated with and are different. Similarly, does not belong to the cut if the eigenvalue of. Note that, we do not care about the exact qubit state associated with each vertex, rather we care only whether they are same or not across an edge. The Max-Cut problem requires us to find an assignment of the qubits on the vertices such that the eigenvalue of the following Hamiltonian is minimized
In other words, for all in the Max-Cut problem. The value of denotes the weight of the edge. In this tutorial we consider an unweighted graph, that is, for all.
defbuild_max_cut_paulis(graph: rx.PyGraph)-> list[tuple[str,float]]:"""Convert the graph to Pauli list. This function does the inverse of `build_max_cut_graph` """ pauli_list= []for edgeinlist(graph.edge_list()): weight= graph.get_edge_data(edge[0], edge[1]) pauli_list.append(("ZZ", [edge[0], edge[1]], weight))return pauli_listmax_cut_paulis=build_max_cut_paulis(graph)cost_hamiltonian= SparsePauliOp.from_sparse_list(max_cut_paulis, n)print("Cost Function Hamiltonian:", cost_hamiltonian)Output:
Cost Function Hamiltonian: SparsePauliOp(['IIIZZ', 'IIZIZ', 'ZIIIZ', 'IIZZI', 'IZZII', 'ZZIII'], coeffs=[1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j])Hamiltonian → quantum circuit
The Hamiltonian contains the quantum definition of your problem. Now you can create a quantum circuit that will helpsample good solutions from the quantum computer. The QAOA is inspired by quantum annealing and applies alternating layers of operators in the quantum circuit.
The general idea is to start in the ground state of a known system, above, and then steer the system into the ground state of the cost operator that you are interested in. This is done by applying the operators and with angles and.
The quantum circuit that you generate isparametrized by and, so you can try out different values of and and sample from the resulting state.
In this case, you will try an example with one QAOA layer that contains two parameters: and.
circuit=QAOAAnsatz(cost_operator=cost_hamiltonian, reps=2)circuit.measure_all()circuit.draw("mpl")Output:

circuit.parametersOutput:
ParameterView([ParameterVectorElement(β[0]), ParameterVectorElement(β[1]), ParameterVectorElement(γ[0]), ParameterVectorElement(γ[1])])Step 2: Optimize problem for quantum hardware execution
The circuit above contains a series of abstractions useful to think about quantum algorithms, but not possible to run on the hardware. To be able to run on a QPU, the circuit needs to undergo a series of operations that make up thetranspilation orcircuit optimization step of the pattern.
The Qiskit library offers a series oftranspilation passes that cater to a wide range of circuit transformations. You need to make sure that your circuit isoptimized for your purpose.
Transpilation may involves several steps, such as:
- Initial mapping of the qubits in the circuit (such as decision variables) to physical qubits on the device.
- Unrolling of the instructions in the quantum circuit to the hardware-native instructions that the backend understands.
- Routing of any qubits in the circuit that interact to physical qubits that are adjacent with one another.
- Error suppression by adding single-qubit gates to suppress noise with dynamical decoupling.
More information about transpilation is available in ourdocumentation.
The following code transforms and optimizes the abstract circuit into a format that is ready for execution on one of devices accessible through the cloud using theQiskit IBM Runtime service.
service=QiskitRuntimeService()backend= service.least_busy( operational=True, simulator=False, min_num_qubits=127)print(backend)# Create pass manager for transpilationpm=generate_preset_pass_manager(optimization_level=3, backend=backend)candidate_circuit= pm.run(circuit)candidate_circuit.draw("mpl", fold=False, idle_wires=False)Output:
<IBMBackend('test_heron_pok_1')>
Step 3: Execute using Qiskit primitives
In the QAOA workflow, the optimal QAOA parameters are found in an iterative optimization loop, which runs a series of circuit evaluations and uses a classical optimizer to find the optimal and parameters. This execution loop is executed via the following steps:
- Define the initial parameters
- Instantiate a new
Sessioncontaining the optimization loop and the primitive used to sample the circuit - Once an optimal set of parameters is found, execute the circuit a final time to obtain a final distribution which will be used in the post-process step.
Define circuit with initial parameters
We start with arbitrary chosen parameters.
initial_gamma= np.piinitial_beta= np.pi/2init_params= [initial_beta, initial_beta, initial_gamma, initial_gamma]Define backend and execution primitive
Use theQiskit Runtime primitives to interact with IBM® backends. The two primitives are Sampler and Estimator, and the choice of primitive depends on what type of measurement you want to run on the quantum computer. For the minimization of, use the Estimator since the measurement of the cost function is simply the expectation value of.
Run
The primitives offer a variety ofexecution modes to schedule workloads on quantum devices, and a QAOA workflow runs iteratively in a session.

You can plug the sampler-based cost function into the SciPy minimizing routine to find the optimal parameters.
defcost_func_estimator(params,ansatz,hamiltonian,estimator):# transform the observable defined on virtual qubits to# an observable defined on all physical qubits isa_hamiltonian= hamiltonian.apply_layout(ansatz.layout) pub= (ansatz, isa_hamiltonian, params) job= estimator.run([pub]) results= job.result()[0] cost= results.data.evs objective_func_vals.append(cost)return costobjective_func_vals= []# Global variablewithSession(backend=backend)as session:# If using qiskit-ibm-runtime<0.24.0, change `mode=` to `session=` estimator=Estimator(mode=session) estimator.options.default_shots=1000# Set simple error suppression/mitigation options estimator.options.dynamical_decoupling.enable=True estimator.options.dynamical_decoupling.sequence_type="XY4" estimator.options.twirling.enable_gates=True estimator.options.twirling.num_randomizations="auto" result=minimize( cost_func_estimator, init_params, args=(candidate_circuit, cost_hamiltonian, estimator), method="COBYLA", tol=1e-2, )print(result)Output:
message: Return from COBYLA because the trust region radius reaches its lower bound. success: True status: 0 fun: -1.6295230263157894 x: [ 1.530e+00 1.439e+00 4.071e+00 4.434e+00] nfev: 26 maxcv: 0.0The optimizer was able to reduce the cost and find better parameters for the circuit.
plt.figure(figsize=(12,6))plt.plot(objective_func_vals)plt.xlabel("Iteration")plt.ylabel("Cost")plt.show()Output:

Once you have found the optimal parameters for the circuit, you can assign these parameters and sample the final distribution obtained with the optimized parameters. Here is where theSampler primitive should be used since it is the probability distribution of bitstring measurements which correspond to the optimal cut of the graph.
Note: This means preparing a quantum state in the computer and then measuring it. A measurement will collapse the state into a single computational basis state - for example,010101110000... - which corresponds to a candidate solution to our initial optimization problem ( or depending on the task).
optimized_circuit= candidate_circuit.assign_parameters(result.x)optimized_circuit.draw("mpl", fold=False, idle_wires=False)Output:

# If using qiskit-ibm-runtime<0.24.0, change `mode=` to `backend=`sampler=Sampler(mode=backend)sampler.options.default_shots=10000# Set simple error suppression/mitigation optionssampler.options.dynamical_decoupling.enable=Truesampler.options.dynamical_decoupling.sequence_type="XY4"sampler.options.twirling.enable_gates=Truesampler.options.twirling.num_randomizations="auto"pub= (optimized_circuit,)job= sampler.run([pub], shots=int(1e4))counts_int= job.result()[0].data.meas.get_int_counts()counts_bin= job.result()[0].data.meas.get_counts()shots=sum(counts_int.values())final_distribution_int={key: val/ shotsfor key, valin counts_int.items()}final_distribution_bin={key: val/ shotsfor key, valin counts_bin.items()}print(final_distribution_int)Output:
{28: 0.0328, 11: 0.0343, 2: 0.0296, 25: 0.0308, 16: 0.0303, 27: 0.0302, 13: 0.0323, 7: 0.0312, 4: 0.0296, 9: 0.0295, 26: 0.0321, 30: 0.031, 23: 0.0324, 31: 0.0303, 21: 0.0335, 15: 0.0317, 12: 0.0309, 29: 0.0297, 3: 0.0313, 5: 0.0312, 6: 0.0274, 10: 0.0329, 22: 0.0353, 0: 0.0315, 20: 0.0326, 8: 0.0322, 14: 0.0306, 17: 0.0295, 18: 0.0279, 1: 0.0325, 24: 0.0334, 19: 0.0295}Step 4: Post-process and return result in desired classical format
The post-processing step interprets the sampling output to return a solution for your original problem. In this case, you are interested in the bitstring with the highest probability as this determines the optimal cut. The symmetries in the problem allow for four possible solutions, and the sampling process will return one of them with a slightly higher probability, but you can see in the plotted distribution below that four of the bitstrings are distinctively more likely than the rest.
# auxiliary functions to sample most likely bitstringdefto_bitstring(integer,num_bits): result= np.binary_repr(integer, width=num_bits)return [int(digit)for digitin result]keys=list(final_distribution_int.keys())values=list(final_distribution_int.values())most_likely= keys[np.argmax(np.abs(values))]most_likely_bitstring=to_bitstring(most_likely,len(graph))most_likely_bitstring.reverse()print("Result bitstring:", most_likely_bitstring)Output:
Result bitstring: [0, 1, 1, 0, 1]matplotlib.rcParams.update({"font.size":10})final_bits= final_distribution_binvalues= np.abs(list(final_bits.values()))top_4_values=sorted(values, reverse=True)[:4]positions= []for valuein top_4_values: positions.append(np.where(values== value)[0])fig= plt.figure(figsize=(11,6))ax= fig.add_subplot(1,1,1)plt.xticks(rotation=45)plt.title("Result Distribution")plt.xlabel("Bitstrings (reversed)")plt.ylabel("Probability")ax.bar(list(final_bits.keys()),list(final_bits.values()), color="tab:grey")for pin positions: ax.get_children()[int(p[0])].set_color("tab:purple")plt.show()Output:

Visualize best cut
From the optimal bit string, you can then visualize this cut on the original graph.
# auxiliary function to plot graphsdefplot_result(G,x): colors= ["tab:grey"if i==0else"tab:purple"for iin x] pos, _default_axes= rx.spring_layout(G), plt.axes(frameon=True) rx.visualization.mpl_draw( G, node_color=colors, node_size=100, alpha=0.8, pos=pos )plot_result(graph, most_likely_bitstring)Output:

And calculate the value of the cut:
defevaluate_sample(x: Sequence[int],graph: rx.PyGraph)->float:assertlen(x)==len(list(graph.nodes()) ),"The length of x must coincide with the number of nodes in the graph."returnsum( x[u]* (1- x[v])+ x[v]* (1- x[u])for u, vinlist(graph.edge_list()) )cut_value=evaluate_sample(most_likely_bitstring, graph)print("The value of the cut is:", cut_value)Output:
The value of the cut is: 5Part II. Scale it up!
You have access to many devices with over 100 qubits on IBM Quantum® Platform. Select one on which to solve Max-Cut on a 100-node weighted graph. This is a "utility-scale" problem. The steps to build the workflow are followed the same as above, but with a much larger graph.
n=100# Number of nodes in graphgraph_100= rx.PyGraph()graph_100.add_nodes_from(np.arange(0, n,1))elist= []for edgein backend.coupling_map:if edge[0]< nand edge[1]< n: elist.append((edge[0], edge[1],1.0))graph_100.add_edges_from(elist)draw_graph(graph_100, node_size=200, with_labels=True, width=1)Output:

Step 1: Map classical inputs to a quantum problem
Graph → Hamiltonian
First, convert the graph you want to solve directly into a Hamiltonian that is suited for QAOA.
max_cut_paulis_100=build_max_cut_paulis(graph_100)cost_hamiltonian_100= SparsePauliOp.from_sparse_list(max_cut_paulis_100,100)print("Cost Function Hamiltonian:", cost_hamiltonian_100)Output:
Cost Function Hamiltonian: SparsePauliOp(['IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZ', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZ', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZI', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZI', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZII', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZII', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIZZIII', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII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 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j])Hamiltonian → quantum circuit
circuit_100=QAOAAnsatz(cost_operator=cost_hamiltonian_100, reps=1)circuit_100.measure_all()circuit_100.draw("mpl", fold=False, scale=0.2, idle_wires=False)Output:

Step 2: Optimize problem for quantum execution
To scale the circuit optimization step to utility-scale problems, you can take advantage of the high performance transpilation strategies introduced in Qiskit SDK v1.0. Other tools include the new transpiler service withAI enhanced transpiler passes.
pm=generate_preset_pass_manager(optimization_level=3, backend=backend)candidate_circuit_100= pm.run(circuit_100)candidate_circuit_100.draw("mpl", fold=False, scale=0.1, idle_wires=False)Output:

Step 3: Execute using Qiskit primitives
To run QAOA, you must know the optimal parameters and to put in the variational circuit. Optimize these parameters by running an optimization loop on the device. The cell submits jobs until the cost function value has converged and the optimal parameters for and are determined.
Find candidate solution by running the optimization on the device
First, run the optimization loop for the circuit parameters on a device.
initial_gamma= np.piinitial_beta= np.pi/2init_params= [initial_beta, initial_gamma]objective_func_vals= []# Global variablewithSession(backend=backend)as session:# If using qiskit-ibm-runtime<0.24.0, change `mode=` to `session=` estimator=Estimator(mode=session) estimator.options.default_shots=1000# Set simple error suppression/mitigation options estimator.options.dynamical_decoupling.enable=True estimator.options.dynamical_decoupling.sequence_type="XY4" estimator.options.twirling.enable_gates=True estimator.options.twirling.num_randomizations="auto" result=minimize( cost_func_estimator, init_params, args=(candidate_circuit_100, cost_hamiltonian_100, estimator), method="COBYLA", )print(result)Output:
message: Return from COBYLA because the trust region radius reaches its lower bound. success: True status: 0 fun: -3.9939191365979383 x: [ 1.571e+00 3.142e+00] nfev: 29 maxcv: 0.0Once the optimal parameters from running QAOA on the device have been found, assign the parameters to the circuit.
optimized_circuit_100= candidate_circuit_100.assign_parameters(result.x)optimized_circuit_100.draw("mpl", fold=False, idle_wires=False)Output:

Finally, execute the circuit with the optimal parameters to sample from the corresponding distribution.
# If using qiskit-ibm-runtime<0.24.0, change `mode=` to `backend=`sampler=Sampler(mode=backend)sampler.options.default_shots=10000# Set simple error suppression/mitigation optionssampler.options.dynamical_decoupling.enable=Truesampler.options.dynamical_decoupling.sequence_type="XY4"sampler.options.twirling.enable_gates=Truesampler.options.twirling.num_randomizations="auto"pub= (optimized_circuit_100,)job= sampler.run([pub], shots=int(1e4))counts_int= job.result()[0].data.meas.get_int_counts()counts_bin= job.result()[0].data.meas.get_counts()shots=sum(counts_int.values())final_distribution_100_int={ key: val/ shotsfor key, valin counts_int.items()}Check that the cost minimized in the optimization loop has converged to a certain value.
plt.figure(figsize=(12,6))plt.plot(objective_func_vals)plt.xlabel("Iteration")plt.ylabel("Cost")plt.show()Output:

Step 4: Post-process and return result in desired classical format
Given that the likelihood of each solution is low, extract the solution that corresponds to the lowest cost.
_PARITY= np.array( [-1ifbin(i).count("1")%2else1for iinrange(256)], dtype=np.complex128,)defevaluate_sparse_pauli(state:int,observable: SparsePauliOp)->complex:"""Utility for the evaluation of the expectation value of a measured state.""" packed_uint8= np.packbits(observable.paulis.z, axis=1, bitorder="little") state_bytes= np.frombuffer( state.to_bytes(packed_uint8.shape[1],"little"), dtype=np.uint8 ) reduced= np.bitwise_xor.reduce(packed_uint8& state_bytes, axis=1)return np.sum(observable.coeffs* _PARITY[reduced])defbest_solution(samples,hamiltonian):"""Find solution with lowest cost""" min_cost=1000 min_sol=Nonefor bit_strin samples.keys():# Qiskit use little endian hence the [::-1] candidate_sol=int(bit_str)# fval = qp.objective.evaluate(candidate_sol) fval=evaluate_sparse_pauli(candidate_sol, hamiltonian).realif fval<= min_cost: min_sol= candidate_solreturn min_solbest_sol_100=best_solution(final_distribution_100_int, cost_hamiltonian_100)best_sol_bitstring_100=to_bitstring(int(best_sol_100),len(graph_100))best_sol_bitstring_100.reverse()print("Result bitstring:", best_sol_bitstring_100)Output:
Result bitstring: [1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1]Next, visualize the cut. Nodes of the same color belong to the same group.
plot_result(graph_100, best_sol_bitstring_100)Output:

Calculate the the value of the cut.
cut_value_100=evaluate_sample(best_sol_bitstring_100, graph_100)print("The value of the cut is:", cut_value_100)Output:
The value of the cut is: 124Now you need to compute the objective value of each sample that you measured on the quantum computer. The sample with the lowest objective value is the solution returned by the quantum computer.
# auxiliary function to help plot cumulative distribution functionsdef_plot_cdf(objective_values:dict,ax,color): x_vals=sorted(objective_values.keys(), reverse=True) y_vals= np.cumsum([objective_values[x]for xin x_vals]) ax.plot(x_vals, y_vals, color=color)defplot_cdf(dist,ax,title):_plot_cdf( dist, ax,"C1", ) ax.vlines(min(list(dist.keys())),0,1,"C1", linestyle="--") ax.set_title(title) ax.set_xlabel("Objective function value") ax.set_ylabel("Cumulative distribution function") ax.grid(alpha=0.3)# auxiliary function to convert bit-strings to objective valuesdefsamples_to_objective_values(samples,hamiltonian):"""Convert the samples to values of the objective function.""" objective_values=defaultdict(float)for bit_str, probin samples.items(): candidate_sol=int(bit_str) fval=evaluate_sparse_pauli(candidate_sol, hamiltonian).real objective_values[fval]+= probreturn objective_valuesresult_dist=samples_to_objective_values( final_distribution_100_int, cost_hamiltonian_100)Finally, you can plot the cumulative distribution function to visualize how each sample contributes to the total probability distribution and the corresponding objective value. The horizontal spread shows the range of objective values of the samples in the final distribution. Ideally, you would see that the cumulative distribution function has "jumps" at the lower end of the objective function value axis. This would mean that few solutions with low cost have high probability of being sampled. A smooth, wide curve indicates that each sample is similarly likely, and they can have very different objective values, low or high.
fig, ax= plt.subplots(1,1, figsize=(8,6))plot_cdf(result_dist, ax,"Eagle device")Output:

Conclusion
This tutorial demonstrated how to solve an optimization problem with a quantum computer using the Qiskit patterns framework. The demonstration included a utility-scale example, with circuit sizes that cannot be exactly simulated classically. Currently, quantum computers do not outperform classical computers for combinatorial optimization because of noise. However, the hardware is steadily improving, and new algorithms for quantum computers are continually being developed. Indeed, much of the research working on quantum heuristics for combinatorial optimization is tested with classical simulations that only allow for a small number of qubits, typically around 20 qubits. Now, with larger qubit counts and devices with less noise, researchers will be able to start benchmarking these quantum heuristics at large problem sizes on quantum hardware.
Tutorial survey
Please take this short survey to provide feedback on this tutorial. Your insights will help us improve our content offerings and user experience.