Hi,everyone! Any help is appreciated :)
I tried to solve a model instance in a python script by applying
SolverFactory().
The code I wrote is the following:
# initialize the instance.
sub_mdl = import_file("Benders.py").model
# Load the data and build a model instance
sub_inst = sub_mdl.create("Benders.dat")
opt=coopr.opt.SolverFactory("cplex")
results=opt.solve(sub_inst)
But the when I run the script, the error messages are the following:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
results=opt.solve(sub_inst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/base/
solver.py", line 147, in solve
self._presolve(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.plugins-2.5-py2.7.egg/coopr/plugins/mip/
CPLEX.py", line 175, in _presolve
ILMLicensedSystemCallSolver._presolve(self, *args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
shellcmd.py", line 92, in _presolve
OptSolver._presolve(self, *args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/base/
solver.py", line 161, in _presolve
self.available()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
ilmcmd.py", line 32, in available
if not shellcmd.SystemCallSolver.available(self, exception_flag):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/coopr.opt-2.4.1-py2.7.egg/coopr/opt/solver/
shellcmd.py", line 52, in available
raise ApplicationError, msg %
self.name
ApplicationError: No executable found for solver 'cplex'
I can solve the problem in the command line by typing : pyomo --
solver=cplex Benders.py Benders.dat
So the solver path is correctly configured. Could someone give me some
ideas of what is going on here?
Thanks a lot in advance!!!