database dump for NEOS server

37 views
Skip to first unread message

cy

unread,
May 18, 2008, 6:46:34 AM5/18/08
to AMPL Modeling Language
hi all,

i'm trying to use the NEOS server for solving my AMPL model. the data,
however, comes from a mysql database. my data file currently contains
'table' and 'read table' commands which get the data from the
database, but the NEOS server seems to require that the actual data be
already in the data file.

is it possible to use AMPL so that the database tables can be dumped
into the data file which will be sent to the NEOS server?

thanks,
cy

Robert Fourer

unread,
May 18, 2008, 10:32:58 AM5/18/08
to am...@googlegroups.com

The "read table" command cannot be used in AMPL scripts that are run by
NEOS. Instead it is necessary to read the database tables using a local
copy of AMPL, then set the solver to "kestrel" and use NEOS's Kestrel server
to run your problem; see http://neos.mcs.anl.gov/neos/kestrel.html for
instructions. You will need to install a Kestrel client on your computer
before proceeding.

This approach does require that you have a local version of AMPL that can
handle the problem you are solving. If you only have a student version,
then you will be limited to 300 variables and constraints even though there
is no such limitation on NEOS. You can get a unrestricted 60-day trial
version of AMPL by following the instructions in "Buy directly from us" at
http://www.ampl.com/vendors.html.

Bob Fourer
4...@ampl.com

cy

unread,
May 19, 2008, 11:47:44 PM5/19/08
to AMPL Modeling Language
hi, sir, thank you for the reply. i did figure out a somewhat 'brute
force' method of generating the data file:

############
model model.mod;
data data.dat;
for {i in _SETS} {
print "display " & i & " > datafile.txt;" > comfile.txt;
}

for {i in _PARS} {
print "printf 'param ' > datafile.txt;" > comfile.txt;
print "display " & i & " > datafile.txt;" > comfile.txt;
if indexarity(i) == 0 then print "print ';' > datafile.txt;" >
comfile.txt;
}
include comfile.txt;
############
the file data.dat mostly contains calls to the local database. the for
loops generate the commands file comfile.txt which in turn creates the
actual data file datafile.txt. this is the file that will be sent to
NEOS.

thanks,
cy
Reply all
Reply to author
Forward
0 new messages