-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow loading a MinimumEigensolverResult
directly into the MinimumEigenOptimizer
#325
Comments
This makes it sounds as this happens more frequently than one might like. Hopefully the root cause of that gets looked at too so as to improve things in that regard. However... Does passing in some result there become stateful on the MEO? I assume you need the same class (or another later instantiated the same way) in order to interpret the result correctly in the context of the original problem; otherwise the result may not make sense. Maybe that's left to the user who somehow needs/wants to interpret a result. |
I didn't experience this myself lately (it's coming from another user) so at least for me it doesn't happen often 🙂
It definitely shouldn't become stateful, that's why the pseudo-code above passes the original quadratic program into the MEO along with the minimum eigensolver result. That should be all the information required to reconstruct the result I think -- but I might be missing something! 😄 |
Thank you for the proposal. It would be nice if users easily interpret Perhaps, it might be useful to separate def prepare_operator(self, problem)
problem_ = self._convert(problem, self._converters)
operator, offset = problem_.to_ising()
return operator, offset
def process_result(self, mes_result, problem=None)
if problem:
# if users interpret results of `VQEClient`, they need to set the problem.
_ = self._convert(problem, self._converters)
samples, best_sol = self._interpret_samples(problem, mes_result)
return self._interpret(best_sol, samples)
def solve(self, problem):
# generate Ising Hamiltonian
operator, offset = self.prepare_operator(problem)
# just run MES, no interpretation
mes_result = self._solve_mes(operator, offset, problem_, problem)
# interpretation in a separate function
result = self.process_result(mes_result) |
Yeah that looks good! We'd have to add a check to |
What should we add?
The
MinimumEigenOptimizer
internally calls a minimum eigensolver and then postprocesses the obtainedMinimumEigensolverResult
in the context of the quadratic program that we try to solve. It would be great if we could directly pass in aMinimumEigensolverResult
into this postprocessing part if we have it already, like:This would be particularly useful in context of the QAOA and VQE runtimes as jobs can get stuck locally but we can easily get the result back from the job ID on the quantum experience (see also qiskit-community/qiskit-nature#479). With the feature here we could then have a workflow like
Names or function calls here are just suggestions 🙂
The implementation should be rather straightforward since we could restructure
MinimumEigenOptimizer.solve
to something likeThe text was updated successfully, but these errors were encountered: