Skip to main content

How do I close gurobi log text file

Answered

Comments

1 comment

  • Eli Towle
    Gurobi Staff Gurobi Staff

    Unfortunately not; logs are written by the underlying Gurobi C library. However, you could use a message callback to capture the Gurobi output line by line, then do whatever you want with it. For example:

    def cb(model, where):
      if where == GRB.Callback.MESSAGE:
            msg = model.cbGet(GRB.Callback.MSG_STRING)
            # do something with msg here

    model.optimize(cb)

    The callback.py example is a good place to start. It uses a message callback to write and manage its own log file.

    0

Please sign in to leave a comment.