Conversation
- Add alap_prepare_times() for As-Late-As-Possible preparation scheduling - Refactor greedy_minimize_time() with separate strategies for unlimited and qubit-limited cases - Add criticality-based prioritization and slack-filling for qubit-limited scheduling - Add tests for ALAP optimization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #158 +/- ##
==========================================
- Coverage 83.65% 83.39% -0.26%
==========================================
Files 21 22 +1
Lines 2313 2530 +217
Branches 416 469 +53
==========================================
+ Hits 1935 2110 +175
- Misses 287 319 +32
- Partials 91 101 +10 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce4fcb1465
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Previously, greedy_minimize_space only prepared neighbors of the measured node, not the node itself. This caused a KeyError when a non-input node with no DAG dependencies had all input neighbors (already prepared). The fix ensures non-input nodes are prepared before measurement by: - Adding the node itself to the preparation set when needed - Updating _calc_activate_cost to account for self-preparation cost Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05a95430bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| current_time = meas_time + 1 | ||
|
|
||
| return prepare_time, measure_time |
There was a problem hiding this comment.
Assign prep times for output-only nodes
greedy_minimize_space only records preparation times when a node is needed to measure a non-output node. If the graph contains output nodes that are never neighbors of any measured node (e.g., an isolated output or outputs connected only to other outputs), the loop exits and returns without ever adding those outputs to prepare_time. Downstream, Scheduler.solve_schedule will fill those nodes with None and Scheduler._validate_all_nodes_scheduled will reject the schedule; more importantly, the returned schedule leaves those output qubits unprepared. Consider a final pass (similar to ALAP in greedy_minimize_time) to assign preparation times for any remaining non-input nodes.
Useful? React with 👍 / 👎.
| # Since dag is {parent: children}, nodes with empty children come first (leaves). | ||
| # This is the correct order for computing criticality (leaves before roots). | ||
| try: | ||
| topo_order = list(TopologicalSorter(dag).static_order()) |
There was a problem hiding this comment.
In _greedy_minimize_time_unlimited, TopologicalSorter takes inv_dag. If the usage is the same here as well, it would be better to rename the parameter accordingly.
| unmeasured = graph.physical_nodes - graph.output_node_indices.keys() | ||
|
|
||
| try: | ||
| topo_order = list(TopologicalSorter(dag).static_order()) |
Before submitting, please check the following:
pytest)ruffmypyandpyrightmake htmlin./docs/- you may need to install dependency for sphinx docs, seedocs/requirements.txt.)Then, please fill in below:
Context (if applicable):
This PR adds greedy scheduling algorithms as a fast alternative to CP-SAT optimization for MBQC pattern scheduling.
Description of the change:
greedy_minimize_time()for minimal execution time schedulinggreedy_minimize_space()for minimal qubit usage schedulingRelated issue:
None