User Guide for macOS

This section contains information specific to using AMPL with Gurobi Solver. General instructions on modeling with AMPL can be found in the book AMPL: A Modeling Language for Mathematical Programming. You can find information about the AMPL book on the AMPL website: The AMPL website also contains sample models that you can download and solve using AMPL-Gurobi.

AMPL is a text-based program that is launched from a terminal prompt. To launch AMPL, simply type ampl from a terminal prompt. When using AMPL, you must explicitly tell AMPL to use the Gurobi solver by issuing the command:

  option solver gurobi_ampl;

If you forget to set the solver to Gurobi, you may receive an error when you try to solve a model.

Gurobi parameters are called "options" in AMPL. AMPL can control Gurobi parameters through the option gurobi_options command. For example,

  option gurobi_options 'presolve 2';

instructs Gurobi to use aggressive presolve. To add options to the current list of gurobi_options, use the command option gurobi_options $gurobi_options. For example,

  option gurobi_options $gurobi_options 'mipgap 0.01';

sets the MIP gap to 0.01, in addition to any existing Gurobi parameters. You can see the list of Gurobi parameters by typing

  gurobi_ampl -=

from a command prompt. A full list of Gurobi parameters for AMPL can be found in the next section.