How to make cplex not output to terminal
Asked Answered
J

1

11

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.

Jillian answered 25/7, 2012 at 1:0 Comment(1)
While solving a MIP model with millions of variables with cplex is non-trivial, it is not at all unusual and the default logging will not affect the solution time in a significant way. On average, the larger the problem instance, the more computation gets performed per line of the log message. (It takes the same amount of time to print a line about 10 cuts as it takes to print a line about 1000 cuts, but it takes much longer to actually compute the 1000 cuts). In fact, for larger problems I will usually set the turn the logging up.Joellajoelle
J
17

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)
Joellajoelle answered 25/7, 2012 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.