cannot invoke XXX: no such program (for all solvers)

1,926 views
Skip to first unread message

huangzi...@gmail.com

unread,
Sep 20, 2017, 3:41:21 PM9/20/17
to AMPL Modeling Language
I met with the problem "Cannot invoke XXX: no such program" for all the solvers I tried.

I saw others reply saying that this is because the solver executable is not in the same path as the ampl.exe, but my problem is a little bit strange. I have checked and confirmed that all the solvers I tried did exist in the path as the ampl.exe, but it still didn't work. (as what you can see in the picture)

I am a Python user. I tried ampl in Python with the following code:

from amplpy import AMPL,Environment
ampl = AMPL(Environment('C:\\Users\\Administrator\\Desktop\\operation research\\amplide.mswin64\\amplide.mswin64'))
ampl.read('C:\\Users\\Administrator\\Desktop\\operation research\\code\\retail.mod')
ampl.readData('C:\\Users\\Administrator\\Desktop\\operation research\\code\\retail.dat')
ampl.setOption('solver','cplex')
ampl.solve()

error turned out: Cannot invoke cplex: no such program. Can any one help to see what the solution is?

Best regards,
Ken
picture.png

Robert Fourer

unread,
Sep 21, 2017, 11:35:28 AM9/21/17
to am...@googlegroups.com
If the path to ampl.exe and the solvers is not in the system search path, then you will have to specify it explicitly for each solver as well. For example:

ampl.setOption('solver','C:\\Users\\Administrator\\Desktop\\operation research\\amplide.mswin64\\amplide.mswin64\\cplex')

To put this in your system search path, open the System control panel, click "Advanced system settings" at the upper left, and click the Environment Variables button in the window that pops up. Then you will see a System Properties window that will let you edit the PATH variable to add C:\Users\\Administrator\Desktop\operation research\amplide.mswin64\amplide.mswin64.

Bob Fourer
am...@googlegroups.com

=======

juan pablo Lira

unread,
Aug 21, 2021, 7:41:04 PM8/21/21
to AMPL Modeling Language
Thanks you, this is the solution!
ampl.setOption('solver','C:\\Users\\Administrator\\Desktop\\operation research\\amplide.mswin64\\amplide.mswin64\\cplex')

on AMPL
option solver 'C:\\Users\\Administrator\\Desktop\\operation research\\amplide.mswin64\\amplide.mswin64\\cplex';

Reply all
Reply to author
Forward
0 new messages