Set mip start by read .sol and .mst file
AnsweredI first solved a mip problem and write the solution to sol file or mst file. Then, I delete a few constraints and want to use the previous solution as a mip start.
1. Which is the right way to restore the previous solution? mst file or sol file?
2. Since the mst file only has the solution of the integer variables. I want to use mip start for a continuous solution as well, how can I do that?
3. I know if I delete some constraints, the solution will be cleared. In what condition, the start attribute will be cleared?
-
Hi Ce,
re 1 and 2, this article should shed some light. You should switch to using .sol files, which also keep the value for continuous variables.
Re 3, the following can be found in the documentation
If you solve a sequence of models, where one is built by modifying the previous one, and if you don't provide a MIP start, then Gurobi will try to construct one automatically from the solution of the previous model. If you don't want it to try this, you should reset the model before starting the subsequent solve. If you provided a MIP start but would prefer to use the previous solution as the start instead, you should clear your start (by setting the
Start
attribute toundefined
for all variables).Perhaps someone from Gurobi support team can comment on this further?
Best regards
Jonasz0 -
1. and 2. have already been correctly answered by Jonasz.
3. I know if I delete some constraints, the solution will be cleared. In what condition, the start attribute will be cleared?
Gurobi will try to re-use as many information about previous MIP solutions as possible. Thus, if you solve a model, then delete some constraints and resolve it, Gurobi will still try to use old solution information. The solution will only be cleared if you explicitly use the reset method or delete the values of the Start attribute for all variables.
Best regards,
Jaromił0 -
Thank you,
From your reply, it means gurobi will treat the previous solution as a special MIP start, which is not open to the user, right?
What about adding new constraints, if I assure the new constraints won't violate the previous solution, gurobi will still use it as MIP start, right?
0 -
From your reply, it means gurobi will treat the previous solution as a special MIP start, which is not open to the user, right?
Yes, Gurobi will use the previous solution for MIP start when re-optimizing.
It is not a special MIP start. You can get the MIP start solution point via accessing the X attribute of all variables or writing it to a file via
model.write("solution.sol")
What about adding new constraints, if I assure the new constraints won't violate the previous solution, gurobi will still use it as MIP start, right?
Correct.
0
Please sign in to leave a comment.
Comments
4 comments