Method to get exact solution?
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.
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?
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)
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.
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
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 I think this now is included in the latest release, right?