AMPL Support

AMPL Scripting Intro

Presentation and examples from the ER220 session on scripting in AMPL.

AMPL for use with Ziena License Manager

These versions of AMPL and the Knitro solver are the latest releases as of March 3, 2008. Please contact me for instruction on accessing the license server. (The Mac Intel versions of AMPL were released May 22, 2009.)

Emacs editor configured for AMPL on Windows

  1. Create the folder c:\emacs

  2. Download (20 MB) and place it in the c:\emacs folder

  3. Unzip it there by right clicking on the zip file and using the WinZip menu item "Unzip to here" (or the equivalent wording) This will create a full installation of emacs, with the AMPL syntax color-coding extension pre-installed. You can delete the zip file after unzipping it.

  4. Create the environment variable HOME with the value c:\emacs\emacs-21-3. This points emacs to the customization that loads "AMPL mode".
    • Right click on "My Computer"
    • Select "Properties", then "Advanced"
    • Click the button for envirornment variables and fill in the values.

  5. Add a shortcut to the "Start" menu.
    • Visit the directory c:\emacs\emacs-21-3\bin in the file manager.
    • Right click on runemacs.exe (not emacs.exe!) and "Create Shortcut".
    • Right click on the Windows "Start" button and click "Explore".
    • Drag the newly created shortcut into the Programs folder under the Start menu
    • Rename the shortcut "Emacs".

Configuring emacs for AMPL on Mac OSX

  1. Create the folder emacs in your home directory.

  2. Download emacs.tgz. This archive contains two files, ampl-mode.el, which implements the AMPL syntax-coloring mode in emacs, and dot.emacs, which is a startup file for emacs to load ampl-mode.

  3. Double-click on emacs.tgz after downloading to open the archive. (Your browser may be set to open this automatically.)

  4. Move the emacs folder into your home directory.

  5. If you already have a .emacs file in your home directory, merge the contents of dot.emacs into your .emacs file. Otherwise move the file dot.emacs into your home directory and rename it .emacs. Depending on your settings, you will no longer see this file in the Finder since it starts with a dot.

  6. When you run emacs, it will load ampl mode and do syntax-coloring for files ending in .mod, .dat, and .ampl

Note that a version of emacs that runs as a native OSX app (not run through Terminal) is available for free downloading at