I've been dealing with a QAOA implementation of a QUBO problem. In order to do this, I converted my QUBO matrix to a QuadraticModel. Once done, I have used Hamiltonian, offset = mdl.to_ising() to generate a Hamiltonianand offset, with mdl being my QuadraticProgram.

Once done, I went on to verify theoretically that the ground state energy of this Hamiltonian tallies with results an annealer. In order to do this, I used:

min_val = NumPyMinimumEigensolver(Hamiltonian)

Sure enough, this matches. The ground state energy when added with the offset value brings the value to 0. Now when I am trying to implement a QAOA, I use the following lines of code. I am aware that I am using deprecated code but I'm not sure this contributes to the problem.

aqua_globals.random_seed = np.random.default_rng(123)
seed = 10598
backend = Aer.get_backend('qasm_simulator')
quantum_instance = QuantumInstance(backend, seed_simulator=seed, seed_transpiler=seed)
qaoa = QAOA(quantum_instance=quantum_instance, p = 1)
qaoa_optimizer = MinimumEigenOptimizer(qaoa)
result = qaoa_optimizer.solve(mdl)

This gives me optimal function value: 2.0 which isn't the result I am looking for.

I think I'm going wrong somewhere in the implementation of the QAOA, but I'm not sure where. Any help in this regard would be absolutely stellar!

  • $\begingroup$ Try to increase your $p$ value (that might help) and rerun your calculation multiple times. You might very well just getting stuck in a local minimum during the optimization step. $\endgroup$
    – KAJ226
    Oct 29 at 20:09
  • $\begingroup$ I tried that by increasing p from 1 till 10 but unfortunately didn't work :( $\endgroup$ Oct 30 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.