Solve a QUBO problem by QAOA algorithm with Qiskit Optimization on a real quantum resources/hardware

44 Views Asked by At

I am following this tutorial https://qiskit-community.github.io/qiskit-optimization/tutorials/03_minimum_eigen_optimizer.html trying to use Qiskit Optimization 0.6.0 to solve a simple quadratic problem by applying QAOA algorythm.

As stated in the tutorial, I used:

algorithm_globals.random_seed = 10598
qaoa_mes = QAOA(sampler=Sampler(), optimizer=COBYLA(), initial_point=[0.0, 0.0])
qaoa = MinimumEigenOptimizer(qaoa_mes)  # using QAOA
exact_result = exact.solve(qubo)
print(exact_result.prettyprint())

The result returned as I expected, however, I think this (MinimumEigenOptimizer from qiskit optimization) was not executed on real quantum machine right? Because I didn't input any token to connect computing resource and my account in IBM quantum platform also didn't show the job.

Therefore, I used the following code try to connect and execute the optimization though real quantum resource backend(I chose the ibmq_qasm_simulator for testing but ideally I want to use a real hardware):

service = QiskitRuntimeService(channel="ibm_quantum",token=token)
backend=service.backend("ibmq_qasm_simulator")
sampler = Sampler(backend=backend)
qaoa_mes = QAOA(sampler=sampler,optimizer=COBYLA())
qaoa = MinimumEigenOptimizer(qaoa_mes)  # using QAOA
exact_result = qaoa.solve(q_model)
print(exact_result.prettyprint())

However, the terminal got stuck and didn't return the answer(not even error message) as in previous code even though I could see a job was executed and completed by ibmq_qasm_simulator from IBM quantum platform.

What is the correct way to do so if I want to solve a QUBO problem by QAOA algorithm with Qiskit Optimization on a real quantum resources/hardware?

0

There are 0 best solutions below