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

Change cvxpy solver #11002

Merged
merged 2 commits into from
Oct 10, 2023
Merged

Change cvxpy solver #11002

merged 2 commits into from
Oct 10, 2023

Conversation

t-imamichi
Copy link
Member

@t-imamichi t-imamichi commented Oct 10, 2023

Summary

CVXPY 1.4.0 has been released recently and it changed the default solver from SCS to CLARABEL.
https://www.cvxpy.org/updates/index.html#cvxpy-1-4

But the new solver took so long time to converge, and the following unit test fails.
test.python.quantum_info.operators.test_measures.TestOperatorMeasures.test_diamond_norm_3

CI log example https://dev.azure.com/qiskit-ci/qiskit/_build/results?buildId=50270&view=logs&j=047b33e0-32e5-58f1-0c38-5f1e11815a2c&t=0892c657-33d9-5456-4eb8-9e7ebbe33ddf

This PR specifies the old solver to pass the unit test.

Details and comments

@t-imamichi t-imamichi requested review from ikkoham and a team as code owners October 10, 2023 13:48
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @ikkoham

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Can you also relax the constraint in constraints.txt, if this is a valid solution?

sol = prob.solve(**kwargs)
sol = prob.solve(solver="SCS", **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

If this works, we should specify the solver as a direct kwarg in the diamond_norm function with a default of "SCS" so that users can continue to override it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I updated the code.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Assuming this passes tests, this looks good to me, thanks for the fix! I hadn't actually spotted in the release notes that there'd been a change in the default solver away from SCS this version, but I just tried it locally and it all seems correct.

Thanks for solving the problem properly!

@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable mod: quantum info Related to the Quantum Info module (States & Operators) Changelog: None Do not include in changelog labels Oct 10, 2023
@jakelishman jakelishman enabled auto-merge October 10, 2023 14:05
@jakelishman jakelishman added this pull request to the merge queue Oct 10, 2023
Merged via the queue into Qiskit:main with commit 4f5d90d Oct 10, 2023
13 checks passed
mergify bot pushed a commit that referenced this pull request Oct 10, 2023
* change cvxpy solver

* apply review comments

(cherry picked from commit 4f5d90d)
github-merge-queue bot pushed a commit that referenced this pull request Oct 10, 2023
* change cvxpy solver

* apply review comments

(cherry picked from commit 4f5d90d)

Co-authored-by: Takashi Imamichi <[email protected]>
@t-imamichi t-imamichi deleted the cvxpy branch October 11, 2023 02:02
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Oct 11, 2023
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py`.
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Oct 11, 2023
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py`.
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Oct 12, 2023
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py` and reduces `test_ef_update`'s runtime.
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Oct 12, 2023
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py` and reduces `test_ef_update`'s runtime.
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Oct 12, 2023
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py` and reduces `test_ef_update`'s runtime.
@t-imamichi
Copy link
Member Author

Details of the solver change. cvxpy/cvxpy#2257

nkanazawa1989 pushed a commit to nkanazawa1989/qiskit-experiments that referenced this pull request Jan 10, 2024
### Summary

Similar to Qiskit/qiskit#11002, this PR fixes
the default solver for cvxpy to SCS. The 1.4.0 release changing the
default solver to Clarabel breaks tomography experiments because
Clarabel expects `max_iter` instead of `max_iters`. Also fixes a new
lint error in `test_drag.py` and reduces `test_ef_update`'s runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog mod: quantum info Related to the Quantum Info module (States & Operators) stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants