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

Stateless VQE #6418

Merged
merged 22 commits into from
Jun 17, 2021
Merged

Stateless VQE #6418

merged 22 commits into from
Jun 17, 2021

Conversation

Cryoris
Copy link
Contributor

@Cryoris Cryoris commented May 14, 2021

Summary

Closes #6380.

Details and comments

Refactor the VQE to become stateless.

  • Remove stateful internal properties
  • Deprecate stateful methods (like get_optimal_point)
  • Make the loss function, get_energy_evaluation publicly available

To do

  • Deprecate all stateful arguments
  • Maybe deprecate all methods except initial_state on VariationalAlgorithm

@Cryoris Cryoris added the mod: algorithms Related to the Algorithms module label May 14, 2021
@Cryoris Cryoris changed the title [WIP] Stateless VQE Stateless VQE Jun 1, 2021
@Cryoris Cryoris marked this pull request as ready for review June 1, 2021 08:38
@Cryoris Cryoris requested review from manoelmarques, woodsp-ibm and a team as code owners June 1, 2021 08:38
it doesn't really matter, having it None was more a safeguard, but adaptVQE breaks if this is None and not 0
* deprecate sort_parameters_by_name
* check ansatz has 0 params in setter
* rename varform -> ansatz
meaning that if a user didn't set it, we re-construct the expectation for each new run of VQE
@mergify mergify bot merged commit ef950e4 into Qiskit:main Jun 17, 2021
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* make VQE stateless

TODO deprecation

* fix get initial point from ansatz

* try fixing use of deprecate_function

* fix tests & black

* deprecate varalgo methods

* sort params per circuit default

* clarify deprecation message in varalgo.initialpoint

* initialize eval_count with 0 instead of None

it doesn't really matter, having it None was more a safeguard, but adaptVQE breaks if this is None and not 0

* simplify get_eigenstate

* fix lint

* remote note on parameter order

* review suggestions

* deprecate sort_parameters_by_name
* check ansatz has 0 params in setter
* rename varform -> ansatz

* fix tests

* lint

* keep previous behaviour of expectation

meaning that if a user didn't set it, we re-construct the expectation for each new run of VQE

* move expectation factory to right place

* address Qiskit#5746

* fix typehint in expectation (add Optional)

* fix expectation setter

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
* make VQE stateless

TODO deprecation

* fix get initial point from ansatz

* try fixing use of deprecate_function

* fix tests & black

* deprecate varalgo methods

* sort params per circuit default

* clarify deprecation message in varalgo.initialpoint

* initialize eval_count with 0 instead of None

it doesn't really matter, having it None was more a safeguard, but adaptVQE breaks if this is None and not 0

* simplify get_eigenstate

* fix lint

* remote note on parameter order

* review suggestions

* deprecate sort_parameters_by_name
* check ansatz has 0 params in setter
* rename varform -> ansatz

* fix tests

* lint

* keep previous behaviour of expectation

meaning that if a user didn't set it, we re-construct the expectation for each new run of VQE

* move expectation factory to right place

* address Qiskit/qiskit#5746

* fix typehint in expectation (add Optional)

* fix expectation setter

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: algorithms Related to the Algorithms module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make VQE stateless
2 participants