next up previous contents
Next: File Upload: Using a Up: Applications Previous: Applications   Contents


AMPL Client: Hooking AMPL to Solvers

The OSAmplClient executable (in COIN-OS/OS/applications/amplClient) is designed to work with the AMPL program (see www.ampl.com). The OSAmplClient acts like an AMPL ``solver.'' The OSAmplClient is linked with the OS library and can be used to solve problems either locally or remotely. In both cases the OSAmplClient uses the OSnl2osil class to convert the AMPL generated nl file (which represents the problem instance) into the corresponding instance representation in the OSiL format.

In the following discussion we assume that the AMPL executable ampl (or ampl.exe on Windows) obtained from www.ampl.com, the OS OSAmplClient, and the test problem hs71.mod are all in the same directory. At first, the user may wish to run everything in the directory

COIN-OS/OS/applications/amplClient
which is where OSAmplClient is located when the OS project is built. The user must obtain ampl and put it in this directory. The test problem hs71.mod can be copied from

COIN-OS/OS/data/amplFiles
It is also assumed that . (the current directory) is in the search path.

The problem instance, hs71.mod is an AMPL model file included in the amplClient directory. To solve this problem locally by calling the OSAmplClient from AMPL first start AMPL and then execute the following commands. In this case we testing Ipopt as the local server and therefore it is necessary that Ipopt be part of the local OS build. If it is not then another solver must be selected and a test problem used that is a linear or integer program.

# take in problem 71 in Hock and Schittkowski
# assume the problem is in the AMPL directory
model hs71.mod;
# tell AMPL that the solver is OSAmplClient
option solver OSAmplClient;
# now tell OSAmplClient to use Ipopt
option OSAmplClient_options "solver ipopt";
# the name of the nl file (this is optional)
write gtestfile;
# now solve the problem
solve;

This will invoke Ipopt locally and the result in OSrL format will be displayed on the screen. In order to call a remote solver service, after the command

option OSAmplClient_options "solver ipopt";
set the solver service option to the address of the remote solver service.
option ipopt_options "service http://gsbkip.chicagogsb.edu/os/OSSolverService.jws";
In this case it is necessary that the Ipopt solver be part of the OS build on the server.


next up previous contents
Next: File Upload: Using a Up: Applications Previous: Applications   Contents
Kipp Martin 2008-01-16