在 CPLEX C# 版本中,我可以在主运行时停用输出吗?

In CPLEX C# version, can I deactivate output when main runs?

我使用 C# 并调用 CPLEX 主函数。代码:

if (opl.ModelDefinition.hasMain())
{                            
     status = opl.Main();
}

当程序运行时,我得到关于 运行 模型的输出。示例:

 ! ----------------------------------------------------------------------------
 ! Satisfiability problem - 21 variables, 221 constraints
 ! Presolve      : 5 extractables eliminated, 1 constraint generated
 ! Workers              = 1
 ! Initial process time : 0.06s (0.02s extraction + 0.03s propagation)
 !  . Log search space  : 112.9 (before), 112.9 (after)
 !  . Memory usage      : 1.7 MB (before), 1.7 MB (after)
 ! Using sequential search.
 ! ----------------------------------------------------------------------------
 !               Branches  Non-fixed            Branch decision
 *                      4 0.11s                 132  = _int12
 *                      6 0.12s                  21  = _int9
 *                      7 0.13s                  22  = _int9
 *                     11 0.13s                  38  = _int13
 *                     15 0.14s                 132  = _int10
 *                     16 0.15s                 133  = _int10
 *                     17 0.16s                  22  = _int9
 *                     20 0.16s                 132  = _int10
 *                     22 0.17s                 133  = _int10

... ...

由于输出,这会使程序变慢。我可以停用写入输出吗?

禁用输出的一种简单方法是更改​​ CP 引擎的 "Log Verbosity" 和 "Log Period" 参数。这可以在 .mod 文件中完成,也可以通过提供具有适当设置的 .ops 文件来完成。

更新: 为了在 .mod 文件中设置内容,将此行放入文件

execute { cp.param.LogVerbosity = "quiet"; }