Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #132 +/- ##
==========================================
+ Coverage 99.35% 99.36% +0.01%
==========================================
Files 17 17
Lines 1858 1901 +43
==========================================
+ Hits 1846 1889 +43
Misses 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… and per-bound M value usage
dnguyen227
commented
Jan 9, 2026
| M::Dict{LogicalVariableRef{M}, T} | ||
| default_M::T | ||
| conlvref::Vector{LogicalVariableRef{M}} | ||
| M::Dict{LogicalVariableRef{M}, Union{T, Vector{T}}} |
Contributor
Author
There was a problem hiding this comment.
Now storing M values for vector constraints as vectors to reflect unique values in each of rows.
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.
This PR fixes the MBM implementation to use the tightest M values possible. This means that each disjunct constraint has it's own M value associated with any other disjunct. Originally only disjuncts has corresponding M values. Infeasible and negative M values are also now used to simplify the overall problem upon reformulation (infeasible problems deactivate disjuncts and sets of negative or 0 M values reveal global constraints).
EXAMPLE
Given a disjunction with:
x <= 2andx >= 10 <= x <= 55When reformulating Y[1]'s constraints with respect to Y[2]'s feasible region (0 ≤ x ≤ 55):
x <= 2: max(x - 2) → M = 53 (at x = 55)x >= 1: max(1 - x) → M = 1 (at x = 0)Before (max M of possible constraints):
x - 53·Y[2] <= 2
x + 53·Y[2] >= 1 ← Both use M = max(53, 1) = 53
After (per-constraint):
x - 53·Y[2] <= 2 ← Uses its own M = 53
x + 1·Y[2] >= 1 ← Uses its own M = 1 (tighter)
The code is largely the same. The change made is
maximum(_maximize_M(...))is now just_maximize_M(...), and order of for loops was adjusted to reflect this.Relevant tests were added to check for these unique M values in addition to verbose comments.