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

Not expected ordering of parameters in energy evaluation call #5721

Closed
dgiannelli opened this issue Nov 13, 2020 · 4 comments
Closed

Not expected ordering of parameters in energy evaluation call #5721

dgiannelli opened this issue Nov 13, 2020 · 4 comments
Assignees
Labels
mod: algorithms Related to the Algorithms module

Comments

@dgiannelli
Copy link

Information

  • Qiskit Aqua version: 0.7., 0.8. up to latest 0.8.1

What is the current behavior?

Using VQE class with a parametrized quantum circuit (i.e. efficientsu2), the energy evaluation function is called with parameters in alphabetical order, and not in numerical order as it happens with method assign_parameters of parametrized quantum circuit.

This leads, for example, to parameters called in order: theta[0], theta[10], theta[11], theta[1], etc... which can cause unexpected behaviors if a program relies on numerical ordering of parameters.

What is the expected behavior?

That the parameters are called in numerical ordering: theta[0], theta[1], theta[2], etc...

Suggested solutions

For the case of parametrized quantum circuit, the class VQAlgorithm in "qiskit-aqua/qiskit/aqua/algorithms/vq_algorithm.py" sorts the parameters in the following way:

self._var_form_params = sorted(var_form.parameters, key=lambda p: p.name)

while it could behave like the parametrized circuit method assign_parameters, which calls them according to the order of the property ordered_parameters.

@woodsp-ibm woodsp-ibm transferred this issue from qiskit-community/qiskit-aqua Jan 26, 2021
@woodsp-ibm woodsp-ibm added the mod: algorithms Related to the Algorithms module label Jan 26, 2021
@woodsp-ibm
Copy link
Member

See #5614

@nonhermitian
Copy link
Contributor

Or see #5557.

@Cryoris
Copy link
Contributor

Cryoris commented Jan 28, 2021

This is a work in progress and should be fixed soon! 🙂

@Cryoris
Copy link
Contributor

Cryoris commented Sep 1, 2021

This should be fixed by #6418 (see the sort_parameters_by_name argument), so I'll go ahead and close this issue 🙂

@Cryoris Cryoris closed this as completed Sep 1, 2021
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

No branches or pull requests

4 participants