User Guide for Microsoft Windows#
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: https://ampl.com. 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 command window. The
supplied Scrolling Window program sw.exe
can be used to launch AMPL.
To start AMPL, open the folder where AMPL is installed, run sw.exe
,
then type ampl
. Advanced users who want to use the standard Windows
command prompt instead of sw.exe
should add the AMPL folder to the
PATH environment variable. 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.