Shakiba Enayati
Shakiba Enayati

Reputation: 23

Cplex Java how to avoid printing the output?

I have an optimization model has to be run within a simulation model every time at each simulation iteration. However, it displays log, error, warning and results as output of Cplex at each iteration. How can I set it off?

I found following link for the same question in python, however I was not able to find the Java command:

Cplex Python how to avoid printing the output

I wonder if anyone can help me with that. Thank you.

Upvotes: 1

Views: 1884

Answers (3)

azar
azar

Reputation: 283

I used the following code and it works.

   IloCplex cplex = new IloCplex();
   cplex.setOut(null);

Upvotes: 5

Christian
Christian

Reputation: 1460

Try

public class NullOutputStream extends OutputStream {    
    @Override
    public void write(int b) throws IOException {
    }
}

and then

setOut(new NullOutputStream());

Upvotes: 0

Guillaume
Guillaume

Reputation: 14656

You can redirect CPlex's output using the setOut(OutputStream s) method:

IloCplex cplex = new IloCplex();
cplex.setOut(...);

Upvotes: 2

Related Questions