I am using "pulp" in python together with GUROBI to solve some optimization problems. For example, the calculations log for GUROBI is:
Optimize a model with 12 rows, 25 columns and 39 nonzeros
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 1e+00]
Found heuristic solution: objective 12
Presolve removed 3 rows and 12 columns
Presolve time: 0.00s
Presolved: 9 rows, 13 columns, 27 nonzeros
Variable types: 0 continuous, 13 integer (13 binary)
Root relaxation: objective 7.000000e+00, 11 iterations, 0.00 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
* 0 0 0 7.0000000 7.00000 0.00% - 0s
Explored 0 nodes (11 simplex iterations) in 0.00 seconds
Thread count was 4 (of 4 available processors)
Optimal solution found (tolerance 1.00e-04)
Best objective 7.000000000000e+00, best bound 7.000000000000e+00, gap 0.0%
('Gurobi status=', 2)
I want to disable this output because I am going to solve 800k optimization problems and writing these logs in the output make my code too slow. Any idea for disabling these logs?
You need to explicitly declare a solver so replace this line
p.solve()
with this
p.solve(PULP_CBC_CMD(msg=0))
or replace `PULP_CBC_CMD with whatever solver you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With