Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Terminal cplex虽然设置了相应的参数,但仍将大量打印到终端_Terminal_Cplex_Ilog - Fatal编程技术网

Terminal cplex虽然设置了相应的参数,但仍将大量打印到终端

Terminal cplex虽然设置了相应的参数,但仍将大量打印到终端,terminal,cplex,ilog,Terminal,Cplex,Ilog,我正在Cpp中使用CPLEX。 谷歌搜索后,我发现需要设置哪些参数以避免cplex打印到终端,我使用它们如下: IloCplex cplex(model); std::ofstream logfile("cplex.log"); cplex.setOut(logfile); cplex.setWarning(logfile); cplex.setError(logfile); cplex.setParam(IloCplex::MIPInterval, 1000);//Controls the

我正在Cpp中使用CPLEX。 谷歌搜索后,我发现需要设置哪些参数以避免cplex打印到终端,我使用它们如下:

IloCplex cplex(model);
std::ofstream logfile("cplex.log");
cplex.setOut(logfile);
cplex.setWarning(logfile);
cplex.setError(logfile);

cplex.setParam(IloCplex::MIPInterval, 1000);//Controls the frequency of node logging when MIPDISPLAY is set higher than 1.
cplex.setParam(IloCplex::MIPDisplay, 0);//MIP node log display information-No display until optimal solution has been found
cplex.setParam(IloCplex::SimDisplay, 0);//No iteration messages until solution
cplex.setParam(IloCplex::BarDisplay, 0);//No progress information
cplex.setParam(IloCplex::NetDisplay, 0);//Network logging display indicator

if ( !cplex.solve() ) {
....
}
但cplex打印了这样的东西:

Warning:  Bound infeasibility column 'x11'.
Presolve time = 0.00 sec. (0.00 ticks)

Root node processing (before b&c):
  Real time             =    0.00 sec. (0.01 ticks)
Parallel b&c, 4 threads:
  Real time             =    0.00 sec. (0.00 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =    0.00 sec. (0.01 ticks)

有没有办法避免打印它们?

使用ILOAlgorization类中的放样方法IloCplex继承自ILOAlgorization。你可以设置一个空输出流作为一个参数,并且防止在屏幕上记录消息。

这是C++中根据

所做的工作。
如您所见,我已经在上面的第三行代码中使用了它。您是否尝试过设置空输出而不是登录到文件?是的,但得到了相同的输出。
cplex.setOut(env.getNullStream());
cplex.setWarning(env.getNullStream());
cplex.setError(env.getNullStream());