Closed vishal-ph closed 1 year ago
Hi, I have attempted to implement the brute_force
method as well as added some unit tests, could you please assign me to this issue?
@lumapools, just did! Thanks
Thank you! Just created the PR with the feature and new tests to be added
We currently have 2 PRs addressing this issue:
What I'd propose is to merge the two PRs and share the bounty. I like the implementation of the function from @GiacomoFrn , and @lumapools nicely added some tests. So, maybe we can take the solution from 239 and then add the (updated) tests from 240. What do you guys say? Could this be a fair solution? :)
Seems a fair solution to me! It was my first open source contribution and I didn't know I was supposed to add tests, @lumapools instead did it.
I think it is a good idea too! How should we go about merging ? Should we first merge @GiacomoFrn 's PR and then I modify my PR (or close it to create a new one) to only include the (new) tests for @GiacomoFrn 's code ?
Perfect!
@vishal-ph I think we follow @lumapools suggestion. What do you think?
thanks @lumapools, @GiacomoFrn for contributing to OpenQAOA and helping solve this issue!
@vishal-ph , @Q-lds I believe I also should be assigned to the issue in order to follow the regulation of the unitaryHack and get part of the bounty
@GiacomoFrn I have added you as well. Hope this fixes it! :)
Prerequisites
Before raising this feature request, I made sure:
Is your feature request related to a problem? Please describe.
OpenQAOA has a function called
ground_state_hamiltonian
that takes as input the Cost Hamiltonian corresponding to the QUBO problem and outputs the degenerate solutions (or ground states of the Hamiltonian) along with the lowest energy (i.e. ground state energy). The function is defined insrc/openqaoa-core/openqaoa/utilities.py
.Expose this function as a
QAOA
workflow class method so users can easily access it.Describe the solution you'd like
Ideal workflow
q = QAOA()
q.compile(qubo)
q.solve_brute_force()
Describe alternatives you've considered
The existing way to obtain the brute force solution of a qubo is described as follows:
qubo
prob_hamiltonian = qubo.hamiltonian
solution, energy = ground_state_hamiltonian(prob_hamiltonian)