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

Switch to qiskit_algorithms #291

Merged
merged 10 commits into from
Sep 6, 2023

Conversation

woodsp-ibm
Copy link
Member

@woodsp-ibm woodsp-ibm commented Aug 18, 2023

Summary

Switches from using qiskit.algorithms, whose use is now deprecated, over to qiskit_algorithms.

Resolves #287

Details and comments

I've listed the items that have been done and tasks under these where changes remain to be done

  1. Added qiskit_algorithms to requirements.txt
  • Need to update this to specify >= 0.2.0, when that version is released, so the algorithm_globals, that has just been migrated there, can be used and logic changed here from importing it from qiskit.utils to importing it from qiskit_algorithms.utils
  1. Added intersphinx to qiskit_algorithms in the docs conf.py, so external refs to that will resolve in the docs

  2. Changed imports and any class refs in docstrings from qiskit.algorithms to qiskit_algorithms. This is in code, tutorials and readme.

  • Update 01/02 portfolio optimization/diversification tutorials. These cannot be switched at present due to specific type checks in Qiskit Optimization, that they use, which need to be relaxed. They also seed algorithm_globals, which needs changing too - see 4. below.
  • Check if the version requirements for qiskit_optimization should be updated to whatever the min version is that it will be that moves over to qiskit_algorithms (0.6.0) (Done via suggestion in comment Switch to qiskit_algorithms #291 (comment) below)
  1. algorithm_globals. I saw some places where its seeded but what is tested does not use any rng from there so I removed these so as to minimize changes that are truly needed in this regard in switching to use the qiskit_algorithms version. Though its a minimal change it seems if we do not need to seed this, as nothing under test draws any random values from it, then we may as well remove the seeding from the test to simplify things.
  • As per 1 above, once qiskit_algorithms 0.2.0 is released and the requirements can be updated, change remaining
  1. There were still a couple of tests using the QuantumInstance so I updated these.

@woodsp-ibm woodsp-ibm added the on hold Can not fix yet label Aug 18, 2023
@coveralls
Copy link

coveralls commented Aug 18, 2023

Pull Request Test Coverage Report for Build 5966254508

  • 5 of 5 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 75.822%

Totals Coverage Status
Change from base Build 5959391826: 0.0%
Covered Lines: 646
Relevant Lines: 852

💛 - Coveralls

requirements.txt Outdated Show resolved Hide resolved
@woodsp-ibm
Copy link
Member Author

Optimization switched to qiskit_algorithms in qiskit-community/qiskit-optimization#537 and this just went through CI fine still using qiskit.algorithms; which was the intent, it working I mean, to accommodate transition of existing code. As Opt now has moved qiskit_algorithms I will update this PR for those aspects I noted and held back on.

@woodsp-ibm woodsp-ibm removed the on hold Can not fix yet label Sep 5, 2023
@woodsp-ibm
Copy link
Member Author

I switched the 2 notebooks that used Qiskit Optimization over to using qiskit_algorithms now that Opt has made the change too. I updated the text a little too as well as some of the variable names that were for VQE originally but things were switched over to SamplingVQE when primitive algos were added. It did not change the function just the naming just to remove them simply being called vqe which might, if one wasn't paying attention, cause some confusion - making it sqve for instance I hope allievates that and makes it clearer its SamplingVQE without putting the whole text in which made things a bit verbose - I did for the method in the class though.

@woodsp-ibm woodsp-ibm changed the title [WIP] Switch to qiskit_algorithms Switch to qiskit_algorithms Sep 5, 2023
@woodsp-ibm
Copy link
Member Author

I did a couple of tweaks to links and text that had Qiskit's finance that are not really about qiskit_algorithms, but since I had this PR open and I was reviewing the docs CI built from this PR and spotted them I figured I'd just fix them here.

@woodsp-ibm
Copy link
Member Author

I had removed the on-hold label and the [WIP] from the title as it's now complete/ready,

Copy link
Collaborator

@t-imamichi t-imamichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@woodsp-ibm woodsp-ibm merged commit 963059f into qiskit-community:main Sep 6, 2023
13 checks passed
@woodsp-ibm woodsp-ibm deleted the move_2_qiskit_algorithms branch September 6, 2023 17:51
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

Successfully merging this pull request may close these issues.

DeprecationWarning in README examples.
3 participants