Greetings,
Regarding these Pyomo versions
Pyomo 5.1.1 (CPython 2.7.11 on Linux 2.6.32-642.6.2.el6.x86_64)
Pyomo 5.2 (CPython 2.7.11 on Linux 2.6.32-642.6.2.el6.x86_64)
It seems that specifying the solver executable at the command line or via the API for GLPK does not work. Pyomo appears to lose the executable or does not use the executable at all.
Example using the command line:
cae_elec.none[166](0)> /programs/cae_elec/apps/anaconda_2.1.0/bin/pyomo solve --solver=glpk --solver-executable=/programs/cae_elec/apps/glpk/install/glpk_4.55/bin/glpsol license.py model.dat
[ 0.00] Setting up Pyomo environment
[ 0.00] Applying Pyomo preprocessing actions
[ 0.00] Creating model
[ 2.40] Applying solver
WARNING: "[base]/site-packages/pyomo/solvers/plugins/solvers/GLPK.py", 150, _default_executable
Could not locate the 'glpsol' executable, which is required for solver 'glpk'
[ 2.40] Pyomo Finished
ERROR: Unexpected exception while running model:
No executable found for solver 'glpk'
cae_elec.none[167](0)> ls -l /programs/cae_elec/apps/glpk/install/glpk_4.55/bin/glpsol
-rwxr-xr-x 1 tboydsto users 6.5K Feb 15 17:24 /programs/cae_elec/apps/glpk/install/glpk_4.55/bin/glpsol
The above shows that glpsol is specified in the command line with --solver-executable and see that the executable exists on the filesystem via ls, yet Pyomo claims it cannot find the glpsol executable.
Similarly, using the API:
opt = SolverFactory("glpk", executable="/programs/cae_elec/apps/glpk/install/glpk_4.55/bin/glpsol")
Produces this error when run:
GLPSOL: GLPK LP/MIP Solver, v4.55
Parameter(s) specified in the command line:
--write /tmp/tmpST7HwW.glpk.raw --wglp /tmp/tmp_uNaAH.glpk.glp --cpxlp /tmp/tmpmeAGO4.pyomo.lp
Reading problem data from '/tmp/tmpmeAGO4.pyomo.lp'...
/tmp/tmpmeAGO4.pyomo.lp:100561: warning: lower bound of variable 'x1' redefined
/tmp/tmpmeAGO4.pyomo.lp:100561: warning: upper bound of variable 'x1' redefined
14577 rows, 13522 columns, 34945 non-zeros
13521 integer variables, all of which are binary
114082 lines were read
Writing problem data to '/tmp/tmp_uNaAH.glpk.glp'...
85564 lines were written
GLPK Integer Optimizer, v4.55
14577 rows, 13522 columns, 34945 non-zeros
13521 integer variables, all of which are binary
Preprocessing...
14160 rows, 13312 columns, 34944 non-zeros
13312 integer variables, all of which are binary
Scaling...
A: min|aij| = 1.000e+00 max|aij| = 1.000e+00 ratio = 1.000e+00
Problem data seem to be well scaled
Constructing initial basis...
Size of triangular part is 14160
Solving LP relaxation...
GLPK Simplex Optimizer, v4.55
14160 rows, 13312 columns, 34944 non-zeros
0: obj = 2.836552165e+05 infeas = 3.980e+02 (0)
500: obj = 2.801720221e+05 infeas = 1.840e+02 (0)
1000: obj = 2.541176700e+05 infeas = 4.000e+01 (0)
* 1020: obj = 2.536857584e+05 infeas = 0.000e+00 (0)
* 1500: obj = 8.497174492e+04 infeas = 0.000e+00 (0)
* 2000: obj = 8.096363135e+04 infeas = 0.000e+00 (0)
* 2089: obj = 8.080844993e+04 infeas = 0.000e+00 (0)
OPTIMAL LP SOLUTION FOUND
Integer optimization begins...
+ 2089: mip = not found yet >= -inf (1; 0)
+ 2418: >>>>> 8.080844993e+04 >= 8.080844993e+04 0.0% (1; 0)
+ 2418: mip = 8.080844993e+04 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 3.6 secs
Memory used: 19.8 Mb (20793800 bytes)
Writing MIP solution to '/tmp/tmpST7HwW.glpk.raw'...
28101 lines were written
ERROR: Expecting 's' row after 'c' rows
Traceback (most recent call last):
File "./assign-lics.py", line 525, in <module>
main()
File "./assign-lics.py", line 489, in main
results = opt.solve(instance, tee=True)
File "/programs/cae_elec/apps/anaconda_2.1.0/lib/python2.7/site-packages/pyomo/opt/base/solvers.py", line 609, in solve
result = self._postsolve()
File "/programs/cae_elec/apps/anaconda_2.1.0/lib/python2.7/site-packages/pyomo/opt/solver/shellcmd.py", line 267, in _postsolve
results = self.process_output(self._rc)
File "/programs/cae_elec/apps/anaconda_2.1.0/lib/python2.7/site-packages/pyomo/opt/solver/shellcmd.py", line 329, in process_output
self.process_soln_file(results)
File "/programs/cae_elec/apps/anaconda_2.1.0/lib/python2.7/site-packages/pyomo/solvers/plugins/solvers/GLPK.py", line 360, in process_soln_file
raise ValueError(msg)
ValueError: Error parsing solution data file, line 2
Both of these errors are resolved when the glpsol executable is added to the PATH.
Has anyone else seen this behavior?
Thanks,
Ted Boydston