Try our new documentation site (beta).
User Guide for Mac OS X
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: http://www.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 the Terminal. To start AMPL, open the Terminal (found in /Applications/Utilities), then type ampl
. 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.
![](/wp-content/plugins/hd_documentations/content/images/documentation-ampl-guide.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-cloud.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-example-tour.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-quick-start.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-reference-manuals.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/documentation-remote-services.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-linux.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-mac-osx.webp?x70725)
![](/wp-content/plugins/hd_documentations/content/images/quickstart-os-windows.webp?x70725)