-
Notifications
You must be signed in to change notification settings - Fork 88
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
Fix missing starts #242
Fix missing starts #242
Conversation
Happy to modify the code to match a preferred codestyle - just let me know! 🙏 |
@aphi Thanks for your contribution. I will raise three questions/remarks:
|
@sebheger Thanks for the feedback 🙏.
At a minimum, we already have test/rcpsp_test.py and examples/tsp-mipstart which add a mip start and at least confirm no runtime errors in doing so. |
@aphi Looks fine so far, please check style with black. As a test case, I would expect to add a really minimalistic example. Could image something like: minimize x Then set start only x=1. After optimization check that you receive two results (the start with x=1 and y=0 and the optimal x=0 and y=1). So this unit test should fail before your bug fix and success afterward. Please squash commits and give the final commit a nice name (ideally linked to issue which is solved) |
af928c3
to
231d37c
Compare
231d37c
to
9d712cf
Compare
@sebheger Style now fixed with black, and I've squashed the commits.
I haven't added that test case as this issue wouldn't be exposed by it. The same optimal solution result is still ultimately found regardless of what values are provided as a mipstart. This issue (#229) fixes mipstarts not being used by CBC to improve the search (unless all zero-valued variables are specified, which shouldn't be a condition). |
Fix for this issue: #229
Context:
CBC officially expects MIP starts to be provided with all non-continuous variables specified. Although this may change in CBC v3 (see first item in changelog: https://github.com/coin-or/Cbc)
However python-mip documentation states "Only the main binary/integer decision variables which appear with non-zero values in the initial feasible solution need to be informed". This implies that zero-valued integer decision variables are the default and need not be supplied. The issue demonstrates that's not the case, as CBC complains.
I've tested this change and it resolves the issue. Odd behaviour can be replicated with partial starts in CBC with other MIPs. e.g. adding to
example/knapsack.py
this linem.start = [(x[0], 0)]
, the MIPStart will fail to find a starting solution (despite all zeros as a valid feasible solution) while under this PR it works as intendedBefore
After
.