Skip to main content

Set mip start by read .sol and .mst file

Answered

Comments

4 comments

  • Jonasz Staszek
    Community Moderator Community Moderator
    Thought Leader
    Gurobi-versary
    First Question

    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 to undefined for all variables).

    Perhaps someone from Gurobi support team can comment on this further?

    Best regards
    Jonasz

     

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • ce jekl
    Collaborator
    Investigator

    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
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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.