Skip to main content

Loading and getting the same solutions everytime

Answered

Comments

1 comment

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi André,

    Do I have to add a callback to terminate the model after 6 hours if, and only if, I got a better solution

    A callback seems like the appropriate solution here.  It sounds like you're across it already, but just in case:
    How do I use callbacks to terminate the solver? 

    You can also use the callback to write solutions to file, so that you do not have to terminate the optimization (in case you're under the impression you need to terminate in order to write a solution to file).

    or I can save and load the BestBd value?

    It's not intuitive but feeding known dual bounds to a solver is not beneficial in the same way that providing known solutions is, for reasons outlined in responses to this post on OR StackExchange.


    The situation you are describing sounds like you are terminating the optimization, then starting again with a fresh branch and bound tree.  I would try and avoid this and continue optimization rather than restarting.  If you terminate your optimization using a callback, simply calling the optimize method again will resume the optimization - it will continue with the existing branch and bound tree, and dual bounds, and previous solutions.  Likewise if you were to interrupt the optimization in an interactive python session (via Ctrl C or something similar) then you can again resume by running the optimize method.

    You may also find it worthwhile taking a guess at parameters which could improve the ability to find the solutions faster.  This tuning webinar and parameter docs would be a good starting point if you have not dipped your toe into these waters before.

    - Riley

     

    0

Please sign in to leave a comment.