Skip to main content

How to use MIPSOL_SOL in gurobipy callback to write solutions meeting certain criteria

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • Gurobi Staff

    Hi Taner,

    I don't think Model.write can be used in this way to write a solution from within the callback.

    Can I suggest casting the solution values to a numpy array and then using numpy.save.

    As of Gurobi v11, any callable python object can be used as the callback argument to Model.optimize, so the lambda approach should be unnecessary unless you are using an older version of Gurobi.  See tsp.py

    - Riley

    0

Post is closed for comments.