-
-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fix_discrete_variables for computing the dual of a MIP #3208
Conversation
Codecov ReportBase: 98.07% // Head: 98.07% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3208 +/- ##
=======================================
Coverage 98.07% 98.07%
=======================================
Files 34 34
Lines 4621 4631 +10
=======================================
+ Hits 4532 4542 +10
Misses 89 89
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
The functionality makes sense but the naming is too confusing. Mathematically there's no relaxation (i.e., enlarging the feasible region) happening when you do this. You're actually restricting the feasible region by fixing variables. I don't have a great suggestion off the top of my head. |
What about a new function like Gurobi calls this |
|
I've left the implementation as a single (now private) function, with two public functions as the API. I can duplicate the code if people would prefer. |
Co-authored-by: Miles Lubin <[email protected]>
x binary | ||
``` | ||
""" | ||
function fix_discrete_variables(var_value::Function, model::Model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont know if the ::Function
was on purpose, but it will force nonspecialize: https://docs.julialang.org/en/v1/manual/performance-tips/#Be-aware-of-when-Julia-avoids-specializing
maybe:
function fix_discrete_variables(var_value::F, model::Model) where {F<:Function}
fix_discrete_variables(model::Model) = fix_discrete_variables(value, model) | ||
|
||
function _relax_or_fix_integrality( | ||
var_value::Union{Nothing,Function}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might want to specialize here at least since the function is called a lot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you seen this be a performance issue on large models?
Speak of the devil: https://discourse.julialang.org/t/jump-support-for-solver-specific-methods-to-create-fixed-mip/94775 |
This comes up quite often on discourse etc, and @jd-lara has written custom code to do this in PowerSimulations etc.
x-ref: #2348 (comment)
Open to bike-shed. I considered making this a separate
relax_integrality_and_fix
function instead of the keyword argument, but the overlap between the two methods is quite large, so it seemed to make more sense as an option.Docs: https://jump.dev/JuMP.jl/previews/PR3208/tutorials/linear/mip_duality/