我在 python 中使用“pulp”和 GUROBI 来解决一些优化问题。例如,GUROBI 的计算日志是:
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)
我想禁用此输出,因为我要解决 800k 优化问题,并且在输出中写入这些日志会使我的代码太慢。禁用这些日志的任何想法?