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

Provide options in the cut-finder API to turn LO gate and wire cut finding off or on, expose min-reached flag. #586

Merged
merged 25 commits into from
May 30, 2024

Conversation

ibrahim-shehzad
Copy link
Collaborator

@ibrahim-shehzad ibrahim-shehzad commented May 10, 2024

Add fields gate_lo and wire_lo to OptimizationParameters in cutting.automated_cut_finding.py to allow the user to turn LO gate and wire cutting off or on. The default is to have them both on.

To do:

  • Enabling only wire cutting causes multiple tests to fail. The same thing will likely happen if only gate cutting is enabled. Test both of these out and fix these tests.
  • Add tests for the CutBothWires action. While running the cut-finder on some circuits with gate_lo set to False (so only wire cut finding enabled), this action was implemented and we realized that there were some new bugs that were not covered by the existing tests.
  • Decide if pieces of the code that track the cost of LOCC wire cuts should be removed completely (cf LO circuit cuts optimizer #471 (comment)).
  • Remove any pieces of the code that were excluded from coverage because they were tied to the rarely invoked CutBothWires instances.
  • Expose metadata field to check if minimum was reached, update tutorial, update tests, and clarify in release note that if the search is terminated early, this flag can give a false negative.

@ibrahim-shehzad ibrahim-shehzad added bug Something isn't working enhancement New feature or request cut finder Related to the automatic cut finder labels May 10, 2024
@ibrahim-shehzad ibrahim-shehzad added this to the 0.7.2 milestone May 10, 2024
@ibrahim-shehzad ibrahim-shehzad self-assigned this May 10, 2024
Comment on lines +140 to +141
gate_lo: bool = OptimizationSettings().gate_lo
wire_lo: bool = OptimizationSettings().wire_lo
Copy link
Member

Choose a reason for hiding this comment

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

One might want to investigate what happens when one sets both gate_lo and gate_lo to False. Ideally this will result in an informative error message (right?).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, for sure.

Copy link
Member

@garrison garrison May 13, 2024

Choose a reason for hiding this comment

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

Also, I want to acknowledge somewhere (i.e., in this comment) that we'll probably change the name of gate_lo eventually. since I doubt it makes any sense to implement LOCC gate cutting now that https://arxiv.org/abs/2312.11638 is out. I cannot think of a better name right this moment. The proper names will depend how far we get implementing parallel and black box cutting from that paper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have gone ahead and added some of the updates that we discussed (7fcfcb1).

@garrison
Copy link
Member

ibrahim-shehzad added this to the 0.7.2 milestone

This adds a feature, so it (as a whole) will have to wait for 0.8.0. It might be that some of the fixes are worth backporting, though.

@ibrahim-shehzad ibrahim-shehzad modified the milestones: 0.7.2, 0.8.0 May 14, 2024
@coveralls
Copy link

coveralls commented May 14, 2024

Pull Request Test Coverage Report for Build 9295628099

Details

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

Totals Coverage Status
Change from base Build 9290071298: 0.0%
Covered Lines: 2401
Relevant Lines: 2401

💛 - Coveralls

@ibrahim-shehzad ibrahim-shehzad marked this pull request as ready for review May 15, 2024 15:23
@ibrahim-shehzad ibrahim-shehzad removed the bug Something isn't working label May 15, 2024
@ibrahim-shehzad
Copy link
Collaborator Author

ibrahim-shehzad commented May 23, 2024

Instances of the greedy search (warm start) algorithm still had access to the LOCC wire-cut cost function and did, in certain instances (when only wire cutting was enabled and the greedy search algorithm was being tested out), output costs that were inconsistent with the LO-only scenario that we currently support. This has now been changed to make things consistent and cost functions that track LOCC wire cuts are no longer exposed anywhere.

@ibrahim-shehzad ibrahim-shehzad changed the title Provide options in the cut-finder API to turn LO gate and wire cut finding off or on. Provide options in the cut-finder API to turn LO gate and wire cut finding off or on, expose min-reached flag. May 23, 2024
caleb-johnson
caleb-johnson previously approved these changes May 23, 2024
Copy link
Collaborator

@caleb-johnson caleb-johnson left a comment

Choose a reason for hiding this comment

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

This looks good. Only a couple of very minor nitpicks.

I wonder if this could've been two PRs but looks good to me as-is

ibrahim-shehzad and others added 4 commits May 29, 2024 19:38
Co-authored-by: Jim Garrison <[email protected]>
Co-authored-by: Jim Garrison <[email protected]>
Copy link
Member

@garrison garrison left a comment

Choose a reason for hiding this comment

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

Thank you -- I am happy with this. 🚀

@ibrahim-shehzad ibrahim-shehzad merged commit e29d561 into main May 30, 2024
11 checks passed
@ibrahim-shehzad ibrahim-shehzad deleted the wire-cut-finder branch May 30, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cut finder Related to the automatic cut finder enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants