-
Notifications
You must be signed in to change notification settings - Fork 140
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
GroverOptimizer
with Sampler
#437
Conversation
Sure, I'm fine with it. Let me finalize the codes. |
@@ -54,6 +57,7 @@ def __init__( | |||
Union[QuadraticProgramConverter, List[QuadraticProgramConverter]] | |||
] = None, | |||
penalty: Optional[float] = None, | |||
sampler: Optional[BaseSampler] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At one point I thought there had been discussion about changing things here so it used the Grover algorithm from Terra - I thought it was now possible since this was done long ago and the Grover implementation since then had become more capable where this could be done. Maybe as an alternate new path, while keeping the old more direct code this is more complex to achieve this time around - i.e. instead of a Sampler it would take a Grover (which itself would already be setup with a Sampler).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the reviewing. I agree with that it is nice to use the Grover
class in Terra. I believe it's possible since the Grover
class can receive functions for iteration
and is_good_state
. So, we can dynamically change the iteration of the Grover operator in the algorithm by squashing the current code into iteration
and is_good_state
. (This might be a good issue for the qiskit advocate mentorship program. I don't have time right now. )
For GroverOptimizer
, we need to change the variables of Grover
dynamically. So, we can pass something like Grover(quantum_instance=quantum_instance)
or Grover(sampler=sampler)
, but this doesn't make much difference, and I think passing a sampler looks better than passing Grover(sampler=sampler)
to me.
GroverOptimizer
with Sampler
GroverOptimizer
with Sampler
Pull Request Test Coverage Report for Build 3484791344
💛 - Coveralls |
I have merged it to #436. So, I close this PR. |
Summary
Add support of
Sampler
toGroverOptimizer
Addresses #425
Details and comments