Try our new documentation site (beta).

User Guide for Linux

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 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.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization