Skip to content

Fix #141: Add MinimumFeedbackVertexSet to ILP reduction#624

Merged
GiggleLiu merged 9 commits intomainfrom
issue-141-mfvs-to-ilp
Mar 17, 2026
Merged

Fix #141: Add MinimumFeedbackVertexSet to ILP reduction#624
GiggleLiu merged 9 commits intomainfrom
issue-141-mfvs-to-ilp

Conversation

@zazabap
Copy link
Collaborator

@zazabap zazabap commented Mar 13, 2026

Summary

Adds a reduction from MinimumFeedbackVertexSet to ILP using the MTZ-style topological ordering formulation. The reduction uses 2n variables (n binary for vertex removal + n integer for topological order) and m + 2n constraints (one per arc + bounds).

Fixes #141

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (9640b88) to head (d57512c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #624      +/-   ##
==========================================
+ Coverage   97.11%   97.12%   +0.01%     
==========================================
  Files         294      296       +2     
  Lines       39220    39392     +172     
==========================================
+ Hits        38088    38259     +171     
- Misses       1132     1133       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

zazabap and others added 2 commits March 13, 2026 07:36
Add MTZ-style topological ordering reduction from MinimumFeedbackVertexSet
to ILP<i32>. Uses 2n variables (n binary + n integer ordering) and m + 2n
constraints. Includes unit tests, example program, and paper documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zazabap
Copy link
Collaborator Author

zazabap commented Mar 13, 2026

Implementation Summary

Changes

  • src/rules/minimumfeedbackvertexset_ilp.rs — New reduction rule implementing MTZ-style topological ordering formulation. Maps MFVS to ILP<i32> with 2n variables (n binary x_i for vertex removal + n integer o_i for topological order) and m + 2n constraints (arc constraints + binary/order bounds). Feature-gated under ilp-solver.
  • src/rules/mod.rs — Registered new module under #[cfg(feature = "ilp-solver")].
  • src/unit_tests/rules/minimumfeedbackvertexset_ilp.rs — 8 unit tests: closed-loop, structure verification, cycle-of-triangles (issue example), DAG input, single vertex, weighted, disjoint cycles, solution extraction.
  • examples/reduction_minimumfeedbackvertexset_to_ilp.rs — Example using the cycle-of-triangles instance (n=9, m=15, FVS=3). Uses ILPSolver directly since BruteForce can't enumerate ILP domain.
  • tests/suites/examples.rs — Registered example test.
  • docs/paper/reductions.typ — Added reduction-rule entry with construction, correctness proof, and solution extraction.
  • docs/src/reductions/reduction_graph.json — Updated with new reduction edge.

Deviations from Plan

  • Used ILP<i32> instead of ILP<bool> because the reduction requires mixed binary + integer variables. Added explicit x_i <= 1 constraints to enforce binary semantics on selection variables, and o_i <= n-1 bounds on ordering variables.
  • Example uses ILPSolver instead of BruteForce since ILP<i32> has DIMS_PER_VAR = i32::MAX + 1, making brute-force enumeration infeasible.

Open Questions

  • None

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new reduction rule from MinimumFeedbackVertexSet (directed) to ILP<i32> using an MTZ-style topological-ordering formulation, plus supporting docs/examples/tests. This expands the reduction graph so MFVS instances can be solved exactly via ILP backends.

Changes:

  • Implement MinimumFeedbackVertexSet → ILP<i32> reduction with 2n variables and m + 2n constraints.
  • Add unit tests + example suite coverage for the new reduction and solution extraction.
  • Regenerate/update documentation artifacts (reduction graph + paper section) to include the new rule.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/rules/minimumfeedbackvertexset_ilp.rs Implements the MFVS→ILP reduction (variable layout, constraints, objective, extraction).
src/rules/mod.rs Registers the new reduction module behind the ilp-solver feature.
src/unit_tests/rules/minimumfeedbackvertexset_ilp.rs Adds correctness/structure tests comparing ILP solutions vs brute force on small instances.
examples/reduction_minimumfeedbackvertexset_to_ilp.rs Adds a runnable/exportable example demonstrating the reduction and verification.
tests/suites/examples.rs Hooks the new example into the example test suite.
docs/src/reductions/reduction_graph.json Updates the generated reduction graph to include the new reduction edge.
docs/paper/reductions.typ Adds a paper-form description of the MFVS→ILP formulation and correctness sketch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

zazabap and others added 4 commits March 15, 2026 12:20
…n_graph.json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove old-style example binary and add canonical_rule_example_specs()
to the MFVS-to-ILP rule, matching the current project convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The solve_ilp function only downcasted to ILP<bool>, causing
`pred solve` to fail for problems that reduce to ILP<i32> (e.g.,
MinimumFeedbackVertexSet). Now tries both ILP<bool> and ILP<i32>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zazabap
Copy link
Collaborator Author

zazabap commented Mar 15, 2026

Review Pipeline Report

Check Result
Copilot comments 0 (approved, no actionable comments)
Issue/human comments 3 checked, 0 actionable
Structural review 11/11 passed
CI green
Agentic test passed
Needs human decision none
Board Ready → Under review → Final review

Fixes applied during review

  1. Merged main — resolved conflicts in src/rules/mod.rs, tests/suites/examples.rs, docs/src/reductions/reduction_graph.json
  2. Migrated example to example-db — removed old-style examples/reduction_minimumfeedbackvertexset_to_ilp.rs, added canonical_rule_example_specs() to the rule file and registered it in mod.rs
  3. Fixed solve_ilp CLI dispatchsolve_ilp() only handled ILP<bool>, breaking pred solve for problems that reduce to ILP<i32>. Now handles both variants.
  4. Formatting fix — after merge with main

Remaining issues for final review

  • None.

🤖 Generated by review-pipeline

GiggleLiu and others added 2 commits March 18, 2026 02:09
# Conflicts:
#	docs/src/reductions/reduction_graph.json
- examples.json now includes MFVS-to-ILP canonical example
- create.rs: remove extra blank line (rustfmt)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@GiggleLiu GiggleLiu merged commit 9ace016 into main Mar 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Rule] MinimumFeedbackVertexSet to ILP

3 participants