Skip to content
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

[from qiskit] Optimizer bounds improvement #57

Open
ElePT opened this issue Aug 22, 2023 · 3 comments
Open

[from qiskit] Optimizer bounds improvement #57

ElePT opened this issue Aug 22, 2023 · 3 comments

Comments

@ElePT
Copy link
Collaborator

ElePT commented Aug 22, 2023

What should we add?

I would like to discuss improving the way bounds are handled and settle/implement such an improvment:

For variational algorithms, like VQE, that use an optimizer, while the initial_point (x0) for the minimize can be passed through the algorithm, if an optimizer supports/requires bounds the way a user might influence this for the algorithm is not obvious. For instance using BOBYQA with VQE works with RealAmplitudes, but fails with UCC since the later ends up with an unbounded setting which fails on the current code. SNOBIT needs bounds and raises an error to that effect, but how to get it to work is asked. NLOpt global optimizers need a bounds and internally this defaults in the case of any limit being unbounded to something that is not (-3pi or 3pi for lower, upper respectively).

In VQE etc initial point used to be informed by the ansatz (preferred_init_point) such that if an explicit value was not passed by the user then it would look to the ansatz, and if that did not exist then just picked a random point. This implicit informing by ansatz was rather hidden and it was preferred to remove this mechanism. Now the initial point must be set by a user and if its left at the default it will be random. I start since things are similar and action was taken for initial point.

An anstaz can presently inform about parameter_bounds. RealAmplitudes does (-pi, pi), Its NLocal parent defaults to None and UCC extends this (via EvolvedOpAnstz) but does not override this. parameter_bounds has a setter, if you know about it and how this is used by VQE etc., so the value can be set/overridden. For a plain parameterized circuit this property does not exist, but of course, given things are Python. it can set (added) at runtime to inform the bounds for VQE. This allows one to set the bounds such that VQE will run with UCC with BOBYQA etc.

So this is to discuss a possible improvement to variational algos like VQE in regards of bounds:

We could simply just document better how things are currently , a tutorial/howto that covers things.

Another option (which can come with doc improvements related to bounds) would be adding an optional bounds parameter that defaults to None (unbounded)

We could, like was done with initial_point remove the information from the ansatz and require a user to explicitly pass a bounds if the optimizer requires it (optimizers have flags to query such) - but using minimizer protocol this is unknown to the algo. When using an optimizer the variational algo can simply raise an error if no bounds is given and the optimizer needs it. For minimizer it would be reliant on whatever the underlying behavior of the code is in regards of bounds if it fails to get it.

We could leave parameter_bounds on ansatz and make it clear in some improved docs that this is also used and how. A variational algo could let any user defined bounds override any informed by the ansatz. The goal being to have the way bounds is set be more exposed to the user rather than how things are currently and make it easier for them.

@Cryoris @mrossinek @adekusar-drl I would welcome opinions, other ideas....

@ElePT
Copy link
Collaborator Author

ElePT commented Aug 22, 2023

Opened by @woodsp-ibm
Original issue & discussion: Qiskit/qiskit#9718

@woodsp-ibm
Copy link
Member

See also #82 for a related feature request

@edoaltamura
Copy link
Contributor

This Qiskit machine-learning issue is also related: qiskit-community/qiskit-machine-learning#570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants