Despite setting the OutputFlag or LogToConsole parameters to 0, Gurobi may still print license and/or compute server information to the standard output:
Compute Server job ID: 11a531ac-9fd9-453d-9c66-e4fc606f97de
Capacity available on 'server:1234' - connecting...
Established HTTP unencrypted connection
Using license file /home/gurobiuser/gurobi.lic
Academic license - for non-commercial use only
This can be undesirable, especially when solving many optimization problems in sequence. Below are two ways to prevent Gurobi from printing out this information.
- Set the OutputFlag or LogToConsole parameter to 0 before the Gurobi environment is started. To do this, create an empty Gurobi environment, set the OutputFlag parameter, and then start the environment. For example, in Python this can be done as follows:
import gurobipy as gp
with gp.Env(empty=True) as env:
env.setParam('OutputFlag', 0)
env.start()
with gp.Model(env=env) as m:
# Build model m here - Create a gurobi.env file (see the reference manual) in the current working directory of your script and add the following line to that file:
OutputFlag 0
orLogToConsole 0
Gurobi automatically looks in the current working directory for a gurobi.env file. If it finds one, it applies the listed parameters to new Gurobi environments. As long as there is a gurobi.env file in the same directory as your scripts, your scripts don't need to explicitly create and start an empty environment:import gurobipy as gp
with gp.Env() as env, gp.Model(env=env) as m:
# Build model m here