Add MIP solver callback for incumbent solutions#50
Open
ryantenney wants to merge 1 commit intojvail:masterfrom
Open
Add MIP solver callback for incumbent solutions#50ryantenney wants to merge 1 commit intojvail:masterfrom
ryantenney wants to merge 1 commit intojvail:masterfrom
Conversation
Wire up GLPK's branch-and-cut callback so callers can get notified when the solver finds a better integer feasible solution. Passes through the current objective value, variables, and relative MIP gap on each IBINGO event. Also extract get_mip_vars into its own helper since we now need it in two places.
Owner
|
Hallo @ryantenney, sorry for the late reply - seems I do not get notified by email for PRs. I'll look into it. |
Owner
|
Thank you for the proposed changes @ryantenney. I have looked into it and it will break one of the examples: Line 44 in 80e1ff5 I don't think it is a big deal to add this tiny breaking change to a 5.1 release. But maybe we could add an example for a MIP that runs for a while and displays callback results in a meaningful way. Do you have any useful MIP problem that could illustrate the feature? I'd be grateful if you could sketch/provide one. |
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 adds support to receieve notifications when the MIP solver finds a better feasible solution. The callback provides the objective value, solver status, and relative MIP gap. If you also need the full variable and row values, you can set
solutions: trueon the callback and callgetSolution()from within the callback, otherwise we don't expend the effort to read the current status of all the decision variables. While this only supportsIBINGOevents at the moment, the GLPK reason code is passed through and all seven constants are exported, so additional events can be supported if desired later, though I have no idea if there is a good use case for supporting the others.The web worker entry point needed updating too as it was only wired up for LP callbacks. Since functions can't be serialized across
postMessage, the worker callsgetSolution()on its side and the main thread wraps the result back up to keep the interface consistent.Rebuilt wasm and dist are included. The additional Emscripten flags add 22 bytes to the binary.
Please let me know what you think, I'm perfectly happy to iterate on this with you.