Fix #97: Add BinPacking to ILP reduction#597
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #597 +/- ##
==========================================
+ Coverage 96.57% 96.59% +0.01%
==========================================
Files 214 216 +2
Lines 29155 29278 +123
==========================================
+ Hits 28157 28280 +123
Misses 998 998 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add the standard assignment-based formulation (Martello & Toth, 1990) for reducing Bin Packing to Integer Linear Programming. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Collaborator
Author
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds a reduction from BinPacking to ILP using the standard assignment-based formulation (Martello & Toth, 1990), with binary variables for item-bin assignments and bin usage indicators.
Changes:
- New reduction rule (
binpacking_ilp.rs) implementing the BinPacking → ILP formulation with n²+n variables and 2n constraints - Comprehensive unit tests and an example demonstrating the reduction on a 5-item instance
- Documentation in
reductions.typdescribing the mathematical formulation and correctness argument
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/rules/binpacking_ilp.rs | Core reduction implementation with variable layout, constraints, and solution extraction |
| src/rules/mod.rs | Registers the new module under the ilp-solver feature |
| src/unit_tests/rules/binpacking_ilp.rs | 7 unit tests covering structure, closed-loop solving, edge cases, and solution extraction |
| examples/reduction_binpacking_to_ilp.rs | Example demonstrating the reduction with JSON export |
| tests/suites/examples.rs | Registers the example as an integration test |
| docs/paper/reductions.typ | Mathematical description of the reduction rule |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add reduction rule from BinPacking to ILP using the standard assignment-based formulation (Martello & Toth, 1990).
Fixes #97