pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Better error reporting when solver is killed or cannot be found

Open danergy opened this issue 6 years ago • 1 comments

When running with a timeout, pyomo is expecting the glpk (for example) to terminate itself. It allows 1 second for this or 1% of the timeout, whichever is longer. If the machine is stressed though then this allowance can be exceeded. The resulting error is misleading:

Solver (glpk) returned non-zero return code (-1) Solver (glpk) did not exit normally

The return code though comes from pyomo itself and is what pyomo generates when it kills glpk. Positive return codes come from glpk etc and should be reported in this way. Negative return codes which come from pyomo should come with an appropriate message such as for -1:

Solver (glpk) killed after timeout allowance exceeded

and for -2 (from my memory):

Solver (glpk) cannot be found

danergy avatar Jul 24 '19 10:07 danergy

I think I have a similar problem. When I specify time limit in the "options" argument of "solve", I immediately get

"ApplicationError: Solver (glpk) did not exit normally"

File "/usr/local/lib/python3.10/site-packages/pyomo/opt/base/solvers.py", line 628, in solve raise ApplicationError("Solver (%s) did not exit normally" % self.name)

This happens immediately. It does not wait until timeout. Just frustrating that this simple little feature has wasted more than a day for me.

But for those who are totally lost, Try the "mipgap" tolerance parameter that can negate the exponential search with binary variables.... and churn out solutions much faster

skannan-maf avatar Oct 15 '24 08:10 skannan-maf