Suppress license output from solver in JuMP.Model

As others have mentioned, the message comes from Gurobi when getting the Gurobi environment. The solution is to get the environment just once, and then re-use that environment:

julia> gurobi_env = Gurobi.Env()
Academic license - for non-commercial use only
Gurobi.Env(Ptr{Nothing} @0x000000002cd049f0)

julia> m = Model(with_optimizer(Gurobi.Optimizer, gurobi_env))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi

julia> m = Model(with_optimizer(Gurobi.Optimizer, gurobi_env))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Gurobi

Notice that each model creation doesn’t trigger a printed warning about the academic license.

3 Likes