Error at _cmdno 28 executing "solve" command

1,955 views
Skip to first unread message

paterijk

unread,
Oct 23, 2008, 3:51:19 AM10/23/08
to AMPL Modeling Language
Hi all,

I have bought cplex and ampl seperately (cplex 11, before ampl, on a
linux server). Unfortunately, I can't solve any problems through ampl.
Here's the problem:

----
I load a model file: model test.mod;
I load a data file: data test.dat;
I tell ampl to use cplex as the solver: option solver cplex;

But if I now type the command "solve", it opens the cplex interactive
solver, instead of solving the problem, and returning to ampl as
expected.
----

I tried different model and data files, and it is completely
independent on the chosen problem. Something is going wrong when ampl
should call to cplex.

Note that when I quit the solver, it gives the following error:

Error at _cmdno 28 executing "solve" command
can't open /tmp/at27782.sol

Furthermore, if I don't specify "option solver cplex;" before the
solve command, then I obtain the following error:

Cannot invoke minos: No such file or directory
exit code 4

It seems that by default the AMPL version that I have received invokes
minos. But why can't I invoke cplex?

Thanx for any hint on this,

Patrick

Paul

unread,
Oct 24, 2008, 9:09:55 AM10/24/08
to AMPL Modeling Language

On Oct 23, 3:51 am, paterijk <pater...@gmail.com> wrote:
> Hi all,
>
> I have bought cplex and ampl seperately (cplex 11, before ampl, on a
> linux server). Unfortunately, I can't solve any problems through ampl.
> Here's the problem:
>
> ----
> I load a model file: model test.mod;
> I load a data file: data test.dat;
> I tell ampl to use cplex as the solver: option solver cplex;
>
> But if I now type the command "solve", it opens the cplex interactive
> solver, instead of solving the problem, and returning to ampl as
> expected.

In order for AMPL to communicate directly with the solver, you need a
solver-specific driver. Do you by any chance have a program or module
named 'cplexamp' (with some extension) installed with AMPL? (The
Windows version uses cplexamp.exe as a bridge between AMPL and
CPLEX.) If so, try 'option solver cplexamp'.

> ----
>
> I tried different model and data files, and it is completely
> independent on the chosen problem. Something is going wrong when ampl
> should call to cplex.
>
> Note that when I quit the solver, it gives the following error:
>
> Error at _cmdno 28 executing "solve" command
> can't open /tmp/at27782.sol

That's fallout from the fact that you don't have the CPLEX driver
installed.
>
> Furthermore, if I don't specify "option solver cplex;" before the
> solve command, then I obtain the following error:
>
> Cannot invoke minos: No such file or directory
> exit code 4
>
> It seems that by default the AMPL version that I have received invokes
> minos. But why can't I invoke cplex?

If 'option solver cplexamp' does not work, you can download source
code for the CPLEX driver from http://www.netlib.org/ampl/solvers/cplex/index.html
and compile it.

/Paul

Eli Olinick

unread,
Oct 24, 2008, 9:44:38 AM10/24/08
to am...@googlegroups.com
You might also try not using option solver at all - just model test.mod; data
test.dat; solve;
Eli

------------------------------------------------
Eli V. Olinick
Associate Professor
Department of Engineering Management, Information, and Systems
Bobby B. Lyle School of Engineering
Southern Methodist University
PO Box 750122
Dallas, TX 75275-0123

Vox: (214) 768 3092
Fax: (214) 768 1112

Operations Research: the Science of Better
http://www.scienceofbetter.org


Robert Fourer

unread,
Oct 24, 2008, 1:51:40 PM10/24/08
to am...@googlegroups.com, paterijk

To use AMPL with CPLEX, you need the version of CPLEX that has the AMPL
interface -- what ILOG (the CPLEX developer) calls cplexamp. The CPLEX
interactive solver doesn't have this interface (because ILOG has chosen not to
include it) and so will not work with AMPL at all. (The message "can't open
/tmp/at27782.sol" appears because the CPLEX interactive optimizer hasn't
written a solution [.sol] file for AMPL.)

You could try asking ILOG for a copy of cplexamp, which is after all just the
same as the CPLEX that you have except for the addition of an AMPL interface
that is freely available. Or you could download the source code for the
AMPL/CPLEX interface from www.netlib.org/ampl/solvers and
www.netlib.org/ampl/solvers/cplex and compile it against the CPLEX callable
library to make your own cplexamp. (That approach is not for everyone,
however, as it requires a proficiency in the use of compilers and makefiles.)

Note that setting "option solver <solvername>;" causes AMPL to invoke the first
executable matching <solvername> in your search path. That is why, if your
solver is called cplexamp, you have to specify "option solver cplexamp;".

Bob Fourer
4...@ampl.com

khan

unread,
Nov 25, 2014, 7:53:15 AM11/25/14
to am...@googlegroups.com, pate...@gmail.com, 4...@ampl.com
I am having I guese same tyope of error.I am trying to solve my model having big number of data set. One variable ldmo is use to having dataset of 165X335 matrix. But when I try to solve it using Neos online solver. It gives me following error. Please suggest some fixings:

Error at _cmdno 3 executing "solve" command
(file amplin, line 441, offset 293872):
error processing param ldmo:
	53195 invalid subscripts discarded:
	ldmo[1,66]
	ldmo[1,67]
	ldmo[1,68]
	and 53192 more.
Error at _cmdno 3 executing "solve" command
(file amplin, line 441, offset 293872):
error processing objective Cost:
	invalid subscript ldmo[1,66]
processing commands.
Executing on neos-4.neos-server.org
 Error (2) in /opt/ampl/ampl -R amplin

jonsh...@gmail.com

unread,
Sep 13, 2019, 9:18:22 PM9/13/19
to AMPL Modeling Language
this works!, in windows is not the command cplex but cplexamp;

AMPL Google Group

unread,
Sep 14, 2019, 10:39:35 AM9/14/19
to AMPL Modeling Language
The name of the "CPLEX for AMPL" application depends on where you got it from:
  • If you downloaded it from us (AMPL Optimization) -- via a link on any ampl.com page -- then it is "cplex" or "cplex.exe", and you should specify "option solver cplex;".
  • If you downloaded it from IBM -- as part of the CPLEX Optimization Studio package -- then it is "cplexamp" or "cplexamp.exe", and you should specify "option solver cplexamp;".
These rules apply for any of the supported platforms: Windows, Linux, or macOS.


--
Robert Fourer
am...@googlegroups.com
{#HS:955492158-54958#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/c27e1daf-a29b-4fb2-bb76-311aa63fbcb3%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages