-
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
Avoid exploring extraneous minima in the cut-finder search space #585
Changes from 11 commits
5911b10
bbd5d11
59eab4f
16d2a13
580b4a9
5998d8f
c4c2968
f2a8ad6
603af4a
16ecc0f
837875c
6ce2d5e
d931ec6
d774c5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,7 +12,7 @@ | |||||
"""File containing the wrapper class for optimizing LO gate and wire cuts.""" | ||||||
from __future__ import annotations | ||||||
|
||||||
from typing import TYPE_CHECKING | ||||||
from typing import TYPE_CHECKING, NamedTuple | ||||||
|
||||||
from .cut_optimization import CutOptimization | ||||||
from .cut_optimization import disjoint_subcircuit_actions | ||||||
|
@@ -21,9 +21,6 @@ | |||||
from .cut_optimization import cut_optimization_min_cost_bound_func | ||||||
from .cut_optimization import cut_optimization_upper_bound_cost_func | ||||||
from .search_space_generator import SearchFunctions, SearchSpaceGenerator | ||||||
|
||||||
import numpy as np | ||||||
from numpy.typing import NDArray | ||||||
from .disjoint_subcircuits_state import DisjointSubcircuitsState | ||||||
|
||||||
if TYPE_CHECKING: # pragma: no cover | ||||||
|
@@ -155,10 +152,10 @@ def get_results(self) -> DisjointSubcircuitsState | None: | |||||
"""Return the optimization results.""" | ||||||
return self.best_result | ||||||
|
||||||
def get_stats(self, penultimate=False) -> dict[str, NDArray[np.int_]]: | ||||||
def get_stats(self, penultimate=False) -> dict[str, NamedTuple | None]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the idea that there might one day be more keys in this dict than just I wonder if this would be better.
Suggested change
but the docstring is still a little bit weird, because it talks about the "value" of the dict without referencing what the key(s) are. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, I think my suggestion of |
||||||
"""Return a dictionary containing optimization results. | ||||||
|
||||||
The value is a Numpy array containing the number of states visited | ||||||
The value is a NamedTuple containing the number of states visited | ||||||
(dequeued), the number of next-states generated, the number of | ||||||
next-states that are enqueued after cost pruning, and the number | ||||||
of backjumps performed. Return None if no search is performed. | ||||||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
upgrade: | ||
- | | ||
The search engine inside the automated cut-finder has been primed to avoid extraneous searches and is therefore expected to run faster. |
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.
Does it complain if you use
SearchStats
as the return type?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.
It doesn't, I have changed that here (d931ec6).