openqaoa icon indicating copy to clipboard operation
openqaoa copied to clipboard

Method to get exact solution?

Open lockwo opened this issue 3 years ago • 5 comments

Is there a built in way to get the actual/exact/true solution to a given problem? Obviously it doesn't scale, but I would like to evaluate how well the QAOA is performing.

lockwo avatar Jun 28 '22 20:06 lockwo

This is indeed a feature that we are currently working on.

There are two paths we could follow: on the one hand, we could provide a few solvers for each class (eg, the brute force algorithm and some known heuristics); on the other hand, we could leverage some third-party library to get some basic benchmarks.

An obvious candidate as a third party could be docplex/cplex, since we are anyway working on a tool to convert problem statements from docplex to the OpenQAOA hamiltonian system and vice-versa.

Do you have any other suggestions? Is there anything that you have been using previously?

Q-lds avatar Jun 29 '22 13:06 Q-lds

Oh, I also forgot about the ground state hamiltonian function! Silly me! :D

For a simulable number of qubits, you can also use the built-in function ground_state_hamiltonian:

from openqaoa.utilities import ground_state_hamiltonian
energy, solution = ground_state_hamiltonian(qubo.hamiltonian)

Q-lds avatar Jun 29 '22 14:06 Q-lds

I have used cplex and gurobi before. I'm not sure if direct integration is needed, but perhaps it there could be a function to render the Hamiltonian in a format amenable to those types of solvers. The exact solution is exactly what I was looking for in this case.

lockwo avatar Jul 02 '22 18:07 lockwo

Yes, we are considering providing some compatibilities between OQ's Hamiltonian and their standards.

I will link this issue to the docplex PR for now

Q-lds avatar Jul 03 '22 07:07 Q-lds

Update: One can now convert a docplex qubo into an equivalent Ising Hamiltonian supported by OQ NOTE: This feature is only supported on branch dev at the moment but will be coming to main soon!

vishal-ph avatar Aug 03 '22 03:08 vishal-ph

@vishal-ph I think this now is included in the latest release, right?

Q-lds avatar Dec 16 '22 02:12 Q-lds