AMPL

# Introduction

GAMS/AMPL allows users to solve GAMS models using solvers within the AMPL modeling system. The GAMS/AMPL link comes free with any GAMS system. Users must have a licensed AMPL system installed and have the AMPL executable in their path.

To run GAMS/AMPL, just specify the solver as ampl. For example, if we wish to solve the trnsport.gms model, we would run

>> gams trnsport.gms lp=ampl


For other GAMS solvers, options can be passed on via solver option files. GAMS/AMPL specific options are described in the section GAMS/AMPL Options.

By default, GAMS/AMPL returns a model status of 14 (no solution) and a solver return status of 1 (normal completion), provided the link is executed normally. This includes the case where the AMPL executable is not found.

GAMS external equations and extrinsic functions cannot be used with GAMS/AMPL.

# AMPL Path

GAMS searches for an AMPL executable using the following hierarchy:

• Via the options AmplPath and RunAmpl within a GAMS/AMPL solver options file.
• An amplpath.txt file located in the GAMS system directory specifying the path of the AMPL executable.
• The system path.

For example, GAMS will first search for the AMPL executable within the ampl.opt file, if specified. If not found, it will search within the GAMS system directory for a file called amplpath.txt specifying the AMPL directory. If amplpath.txt is still not found, GAMS will try the system path.

If no AMPL executable is found, the user will see a message similar to

AMPL Link 2.0    Jul  4, 2012 23.9.5 WIN 36376.36401 VS8 x86/MS Windows

--- No AmplPath option or "amplpath.txt" file found
--- System PATH will be used


There may also be an output indicating that AMPL was not found, either because it was not installed or because it was not found in the system path.

# GAMS/AMPL Options

Option Description Default
AmplPath Path to AMPL System files
DotMod AMPL input file name ampl.mod
Option Verbatim AMPL options
For example, to run AMPL/MINOS with the options timing=3 outlev=2, put the following entry into your ampl.opt file:
 option minos_options "timing=3 outlev=2";
RunAmpl Name of AMPL executable ampl
TolNone Tolerance to interpret status none 1e-12