DiegoNolan DiegoNolan - 1 year ago 165
C++ Question

How to make cplex not output to terminal

I am using the IBM cplex optimizer to solve an optimization problem and I don't want all terminal prints that the optimizer does. Is there a member that turns this off in the IloCplex or IloModel class? These are the prints about cuts and iterations. Prints to the terminal are expensive and my problem will eventually be on the order of millions of variables and I don't want to waste time with these superfluous outputs. Thanks.

Answer Source

Using cplex/concert, you can completely turn off cplex's logging to the console with


Where cpx is an IloCplex object. You can also use the setOut function to redirect logs to a file.

There are several cplex parameters to control what gets logged, for example MIPInterval will set the number of MIP nodes searched between lines. For example, turning MIPDisplay to 0 will turn off the display of cuts except when new solutions are found, which MIPDisplay of 5 will show detailed information about every lp-subproblem.

Logging-related parameters include MIPInterval MIPDisplay SimDisplay BarDisplay NetDisplay

You set parameters with the setParam function.

cpx.setParam(IloCplex::MIPInterval, 1000)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download