Skip to main content

Suppress console outputs

Answered

Comments

4 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.
  • Simranjit Kaur
    • Gurobi Staff

    Hi Xinshuo,

    To suppress all output, you can set the OutputFlag parameter to 0 in your environment. Alternatively, you can direct the log to a file without printing it to the console by setting the LogToConsole parameter to 0 in your environment.  For example,

    import gurobipy as gp

    #create an environment
    env = gp.Env()

    # set parameters to supress outputs
    env.setParam("OutputFlag",0) # supress all outputs
    #env.setParam("LogToConsole",0) # supress console outputs only

    # use the env when reading the model m = gp.read("glass4.mps", env)

    Regards,

    Simran

    0
  • Gwyneth Butera
    • Gurobi Staff

    I have updated the article How do I suppress all console output from Gurobi? to include an example of reading a model from a file.

    0
  • Xinshuo Yang
    • Gurobi-versary
    • Curious
    • First Comment

    Thank you very much.

    0

Post is closed for comments.