JuMP: how NOT to display the results of an optimization problem in the REPL?


I am using JuMP (0.18.4) (with Gurobi as solver) in a script to solve the same optimization problem for different input. This results in the same optimization problem being solved for many times.
Now, everything seems to work, except for the fact that every time the optimization problem is solved for a certain input set, something like the following is printed in the REPL:

Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Optimize a model with 15 rows, 76 columns and 122 nonzeros
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [2e+02, 1e+04]
RHS range [0e+00, 0e+00]
Iteration Objective Primal Inf. Dual Inf. Time
0 -5.7489940e+04 7.230620e+02 0.000000e+00 0s
9 -5.7489940e+04 0.000000e+00 0.000000e+00 0s

Solved in 9 iterations and 0.00 seconds
Optimal objective -5.748994012e+04

Solved in 3 iterations and 0.00 seconds
Optimal objective -4.592409418e+04

Now, if this is printed thousands of times, at one point I don’t manage seeing some other information I may have printed beforehand in the REPL and which I may need to visualize later too.
So, my question is: is there a way to completely suppress the aforementioned output from being printed/displayed in the REPL?
By the way, I am using Julia 0.6.4.

GurobiSolver(OutputFlag=0). Different solvers have different flags for controlling verbosity.

1 Like

@tkoolen Thank you so much, now the problem is completely solved!!

I couldn’t managed to change the verbosity in those lines of code.
Hope you can help

optimizer = Juniper.Optimizer
nl_solver = optimizer_with_attributes(Ipopt.Optimizer, “print_level”=>0)
model1 = Model(optimizer_with_attributes(optimizer, “nl_solver”=>nl_solver))

The printing comes from Ipopt or Juniper?

Hello @Henrique_Becker .
I did manage to solve my problem by including log_levels in the following in the model’s attributes

model1 = Model(optimizer_with_attributes(optimizer, “nl_solver” => nl_solver,“log_levels” => [ ]))

We could add in the brackets both :Info or :Table