How to disable the output messages in CPLEX solver?
Asked Answered
B

1

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?

Bias answered 3/7, 2015 at 16:29 Comment(1)
Is the new cplex.exe install in your environment path ?Teriteria
P
4

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

Punish answered 30/7, 2015 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.