Repository navigation
Conversation
Pass the current values of the discrete variables to HiGHS as a sparse (partial) MIP start. Requires HiGHS >= 1.8; older versions log a warning and skip the start.
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.
Fixes
Part 2 of #4044 (part 1: #4046)
Summary/Motivation:
The
contrib.solverHiGHS interface (highs) has no MIP warm start. The Gurobi and SCIP interfaces in the same framework provide thewarmstart_discrete_varsoption, which passes the current values of the integer variables to the solver. This PR adds the same option for HiGHS. Because only discrete values are passed, the start is partial by design. HiGHS supports partial starts since 1.8 through the sparsesetSolution(num_entries, index, value)overload: all columns not passed are set tokHighsUndefined, and HiGHS completes the start itself.Changes proposed in this PR:
Add
HighsConfig(derived fromPersistentBranchAndBoundConfig) with the optionwarmstart_discrete_vars(defaultFalse), worded as in the Gurobi and SCIP interfaces.Add
Highs._mipstart(), which passes all integer variables that have a value to HiGHS via the sparsesetSolutionoverload. On HiGHS < 1.8, which has neither the overload nor partial starts, it logs a warning and skips the start. It is called beforecapture_output, because a warning logged inside that block would only end up in the solver log.Add tests to
test_highs.py:Noneis not carried over from the previous start;mock).The warm-start tests are skipped on HiGHS < 1.8.
AI-Use Disclosure
or
AI tools contributed to the development of this PR
Review process (select ONE):
Notes for reviewers (optional):
Behaviour on re-solves: every solve passes the values the variables have at that time, so after a solve the loaded results serve as the next start. Variables without a value are left undefined, because a new sparse solution is passed on every solve. With the option off, nothing is passed, although HiGHS itself may reuse its last solution if the model has not changed (existing HiGHS behaviour, not touched here).
One question:
_mipstart()only setsStartfor variables that have a value. In the persistent interface, a variable reset toNonewould therefore probably (I did not verify it yet) keep itsStartfrom an earlier solve. Is that intended?The partial-start test uses the same deliberately loose constraint as in #4046 (
x1 <= 3 + 7 * x3); with a tighter version, presolve solves the model before the start is evaluated. The sparsesetSolutionoverload is available from HiGHS 1.8 on; I tested with highspy 1.15.1.Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: