如何将求解器在纸浆中生成的报告保存为文本文件

How to save the report made by solver in pulp as a text file

我想保存报告(如果你 运行 它例如在 vscode 它在终端中显示报告)由像 CBC 这样的求解器在 python's pulp 自动打包为文本文件。有任何想法吗?有可能吗?我已经阅读了文档,但没有找到任何内容。这是报告的一部分,我的意思是:

Welcome to the CBC MILP Solver 
Version: 2.9.0
Build Date: Feb 12 2015

这是另一部分:

Result - Optimal solution found

Objective value:                3333.15276400
Enumerated nodes:               0
Total iterations:               1
Time (CPU seconds):             0.01
Time (Wallclock seconds):       0.01

Option for printingOptions changed from normal to all
Total time (CPU seconds):       0.03   (Wallclock seconds):       0.02

它还在继续...

可能是你读书不够用功。有一个 logPath 参数用于存储 cbc 日志: https://coin-or.github.io/pulp/technical/solvers.html#pulp.apis.COIN_CMD