c++mathematical-optimizationlinear-programmingcplexilog

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.


Solution

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

    cpx.setOut(env.getNullStream())
    

    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. Turning MIPDisplay to 0 will turn off the display of cuts except when new solutions are found, while 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)