-
Notifications
You must be signed in to change notification settings - Fork 33
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
Remove greedy recursion #537
Conversation
Co-authored-by: Jim Garrison <[email protected]>
Co-authored-by: Jim Garrison <[email protected]>
Co-authored-by: Jim Garrison <[email protected]>
Otherwise, a deprecation warning will show any time the tests are run
Otherwise we see the following when we run tests ``` circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.cross_entropy <doctest circuit_knitting.utils.metrics.cross_entropy[0]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.cross_entropy()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.MSE <doctest circuit_knitting.utils.metrics.MSE[0]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.MSE()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.MAPE <doctest circuit_knitting.utils.metrics.MAPE[0]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.MAPE()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.chi2_distance <doctest circuit_knitting.utils.metrics.chi2_distance[0]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.chi2_distance()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.chi2_distance <doctest circuit_knitting.utils.metrics.chi2_distance[1]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.chi2_distance()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. circuit_knitting/utils/metrics.py::circuit_knitting.utils.metrics.HOP <doctest circuit_knitting.utils.metrics.HOP[0]>:1: DeprecationWarning: The function ``circuit_knitting.utils.metrics.HOP()`` is deprecated as of circuit-knitting-toolbox 0.7.0. It will be removed Circuit knitting toolbox 0.8.0 release. ```
Otherwise, we will see a deprecation warning
Co-authored-by: Jim Garrison <[email protected]>
Pull Request Test Coverage Report for Build 8656075716Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
With pieces of older git history showing up above, it looks like I may have (accidentally) created this branch locally from the deprecate-cutqc branch, instead of from main. Let me know if this is a problem and I should undo this and start over. |
@ibrahim-shehzad This can happen if you have commits from a feature branch and then those commits are squashed when that branch is merged. Git doesnt know what to do so it keeps things in the diff that are not actual changes. I think you can just checkout the main versions of these files and then commit and push those files and it'll update the diff |
This looks nice, and it appears to implement the same logic. If you could just say something about what the conditions are when this loop should end, I'd like to consider if there are cases which could cause this to run forever. |
else: | ||
# avoid using recursion to stay clear of any risk of stack overflow. | ||
state = best[-1] | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't take my suggestion above, I think we can remove this continue
anyway. I don't think it does anything. The while
loop will evaluate its condition next regardless of whether this is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. A couple of small style suggestions, but it's fine to merge as-is IMO. Thanks!
This PR aims to resolve #536, by getting rid of recursion inside the
greedy_best_first_search
algorithm that is used to warm start the search performed by the cut-finder. I have replaced recursion with a simplewhile
loop and have verified that the issues reported to us for large QAOA circuits (which led to #536) are now avoided. Since these circuits have large widths, the algorithm takes a while to finish running and any direct tests on these circuits would significantly slow down the overall testing process. This is why I have not added any new tests at this stage.