AMPL IDE does not work with cplex

456 views
Skip to first unread message

Kaien Nicola

unread,
Jul 21, 2017, 9:24:09 AM7/21/17
to AMPL Modeling Language
I've found that AMPL IDE Version: 3.1.0.201510231950 does not work with cplex solver, here is my commands:
ampl: model 'lp.mod';
ampl: option solver cplex;
ampl: solve;

Incorrect usage. Correct command syntax is:
   cplex [-i] [-f <commandfile> | -c "<command1>" "<command2>" ...]
Exiting
Error executing "solve" command:
can't open C:\Users\nys\AppData\Local\Temp\at2384.sol

The same commands work fine in console mode as:
ampl: option solver cplex;
ampl: solve;
CPLEX 12.7.1.0: optimal solution; objective 0
0 simplex iterations (0 in phase I)

Switching to other solvers as gurobi in IDE works also fine as:
ampl: option solver gurobi;
ampl: solve;
Gurobi 7.5.0: optimal solution; objective 0

So I guess it could be a bug in AMPL IDE. Any suggestion? Thanks in advance!

Robert Fourer

unread,
Jul 21, 2017, 1:34:39 PM7/21/17
to am...@googlegroups.com
Our Windows CPLEX for AMPL is distributed as an executable file cplex.exe. But IBM's CPLEX distribution also contains a cplex.exe, which is the executable for a simple CPLEX command interface that is unrelated to AMPL; the "Incorrect usage ..." error message comes from that IBM cplex.exe. When you have two (or more) cplex.exe files on your computer, the AMPL IDE may not run the one that you intend, depending on where the files are located and how the Path environment variable is set.

You could try this quick fix. Use the Windows search feature to look for "cplex.exe" files on your computer. Identify the one that is in a subfolder of the IBM CPLEX distribution, and rename it to something else (say, cplex0.exe).

Bob Fourer
am...@googlegroups.com

=======

niuys

unread,
Jul 24, 2017, 8:10:12 PM7/24/17
to AMPL Modeling Language
Dear Prof. Fourer,
That's really the path problem. I've fixed it. Thanks a lot for your reply.


在 2017年7月21日星期五 UTC+8下午9:24:09,niuys写道:

monu...@gmail.com

unread,
Dec 7, 2017, 8:37:59 AM12/7/17
to AMPL Modeling Language
Yes, niyus thank you for your reply too.
And warm thank you to Prof. Fourer.
Reply all
Reply to author
Forward
0 new messages