Skip to main content





  • Darragh Ferguson
    First Question
    First Comment

    I now realise that when we set these variable values and call optimize again, the hints are being considered and the solver starts from the last objective value anyway. So can we do something along the lines of:

    x[i, j, s].Start = 0
    x[j, i, s].Start = 0

    to force these values?

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Darragh,

    I think you might be confusing variable hints with MIP starts (which is set using the Start attribute).  A hint is just used to guide the solver in its search - in things like heuristics - and there is no guarantee that the solver will even evaluate a solution that could be constructed by setting variables to their hint values.

    From what you are describing I suspect you want to use MIP starts.  You could alternatively also use a MIPSOL callback, where you use cbGetSolution to retrieve the solution, modify it, then give it back to the solver with cbSetSolution.

    Note that you can always use Model.reset() to clear previous solution information between solves.  If you use MIP starts, do not call reset(), and the model still resumes with the previous solution instead of the solution specified by the MIP start then either the MIP start was rejected for being infeasible, or perhaps ignored because it was only a partial solution and extending it to a full solution was proving costly, or lastly it could be that the solution specified by the MIP start is worse than the one previously found.

    - Riley

  • Gwyneth Butera
    Gurobi Staff Gurobi Staff

    You can also have a look at our Knowledge Base article What are the differences between MIP Starts and Variable Hints? G.


Please sign in to leave a comment.