Skip to content

Conversation

@masa10-f
Copy link
Collaborator

@masa10-f masa10-f commented Nov 17, 2025

Before submitting, please check the following:

  • Make sure you have tests for the new code and that test passes (run pytest)
  • If applicable, add a line to the [unreleased] part of CHANGELOG.md, following keep-a-changelog.
  • Format added code by ruff
  • Type checking by mypy and pyright
  • Make sure the checks (github actions) pass.
  • Check that the docs compile without errors (run make html in ./docs/ - you may need to install dependency for sphinx docs, see docs/requirements.txt.)

Then, please fill in below:

Description of the change:

This PR significantly enhances the MBQC pattern scheduling functionality
and adds feedforward optimization capabilities.

  • Greedy Scheduler Implementation: Fast heuristic schedulers as
    alternatives to CP-SAT solver (updated the previous algorithms I have implemented in Graphix)
    • greedy_minimize_time: Greedy scheduler prioritizing minimal execution time
    • greedy_minimize_space: Greedy scheduler prioritizing minimal qubit usage
    • Useful for large-scale graphs or when optimality is not critical
    • Added max_qubit_count constraint support to schedulers
  • Feedforward Optimization: Pauli simplification for
    feedforward optimization
    • pauli_simplification: Removes redundant Pauli corrections (originally proposed in the measurement calculus, and I have reimplemented it in the pure feedforward layer)
  • New Pattern Properties: Additional metrics for pattern evaluation
    • volume: Sum of space across all timeslices
    • max_volume: Maximum volume (max_space × depth)
    • idle_times: Idle time for each qubit
    • throughput: Number of measurements per TICK

Related issue:

@masa10-f masa10-f self-assigned this Nov 17, 2025
@masa10-f masa10-f added the enhancement New feature or request label Nov 17, 2025
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 65.97938% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.00%. Comparing base (b2179b5) to head (eaf7e81).
⚠️ Report is 2 commits behind head on master.

❌ Your patch check has failed because the patch coverage (65.97%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
- Coverage   76.05%   74.00%   -2.05%     
==========================================
  Files          21       22       +1     
  Lines        2209     2497     +288     
  Branches      378      454      +76     
==========================================
+ Hits         1680     1848     +168     
- Misses        456      564     +108     
- Partials       73       85      +12     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@masa10-f masa10-f marked this pull request as ready for review December 20, 2025 07:06
@masa10-f
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

@masa10-f
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

Comment on lines 110 to 114
for node in to_measure:
for neighbor in neighbors_map[node]:
if neighbor not in prepared:
prepare_time[neighbor] = current_time
prepared.add(neighbor)

Choose a reason for hiding this comment

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

P1 Badge Prepare measured nodes when neighbors already prepared

The greedy schedulers never assign a preparation time to the node being measured; the loop only schedules its neighbors. When a candidate’s neighbors are already in prepared (e.g., the first non‑input node in the DAG is only adjacent to inputs), the block at lines 110‑114 leaves that measured node out of prepare_time, so solve_schedule(use_greedy=True) records None for its prep time. validate_schedule then fails with “Nodes … have no preparation time scheduled” and entanglement auto‑scheduling cannot run, even though a valid schedule exists. The same neighbor‑only preparation appears in greedy_minimize_space (lines 272‑277).

Useful? React with 👍 / 👎.

masa10-f and others added 4 commits December 28, 2025 17:27
…_time

Add alap_prepare_times() function that recomputes preparation times using
ALAP (As Late As Possible) strategy. Given fixed measurement times, this
computes the latest possible preparation time for each node while respecting
neighbor constraints.

Changes:
- Add alap_prepare_times() function to greedy_scheduler.py
- Apply ALAP post-processing in _greedy_minimize_time_unlimited()
- Apply ALAP post-processing in _greedy_minimize_time_limited()
- Update and add test cases for ALAP behavior

This reduces active volume (sum of qubit lifetimes) without changing
the measurement schedule or depth.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants