Skip to main content

Output variable values of the warm-start solution

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Eli Towle
    • Gurobi Staff

    You could use a callback function. Every time Gurobi finds a new incumbent solution, the MIPSOL callback is called. Whenever this happens, you can query the solution values with Model.cbGetSolution():

    def my_cb(model, where):
        if where == GRB.Callback.MIPSOL:
            print(model.cbGetSolution(model._vars))

    m._vars = m.getVars()
    m.optimize(my_cb)

    Alternatively, you could set the SolFiles parameter. This will direct Gurobi to write every new incumbent solution to disk:

    m.Params.SolFiles = 'foo'
    1
  • David Wittwer
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks a lot!

    0

Post is closed for comments.