8

I am using Pulp modeler with python to solve an integer programming problem. I am using IBM CPLEX as a solver. When I run my Python program, I have a lot of output messages in the console like:

The CPLEX Optimizers will solve problems up to 1000 variables and 1000 constraints. IBM ILOG CPLEX Optimization Studio Preview Edition good for 48 more days ...

I look for a solution on the internet and I fix the issue. So I disable the display by writing msg=0 as follows:

from coinor.pulp import *
# ...
prob = LpProblem("MyProblem", LpMaximize)
# ...
prob.solve(CPLEX(msg=0))

Yesterday I removed some softwares from my computer and when I tried to run my Python program, Python says cannot run cplex.exe. I find out that something went wrong with my environment variables (all environment variable in path are erased). So I re-installed the CPLEX solver and I run exactly the same program but I still have the output messages now even with msg=0.

What do you think is the problem? And how can I disable the output messages?

Learning
  • 183
  • 6

1 Answers1

4

Maybe simply redirect stdout of the command to nul? cplex.exe ..your args.. > nul

Anton Malyshev
  • 8,035
  • 2
  • 23
  • 41