# AMPL

File:AMPL (textbook cover).jpg | |

Paradigm | multi-paradigm: declarative, imperative |
---|---|

Designed by | Robert Fourer David Gay Brian Kernighan Bell Labs |

First appeared | 1985 |

Stable release | 20131012 / October 12, 2013 |

OS | Cross-platform (multi-platform) |

License | Proprietary (translator), free and open-source (AMPL Solver Library) |

Filename extensions | .mod .dat .run |

Website | www.ampl.com |

Influenced by | |

AWK, C | |

Influenced | |

Coopr |

**AMPL**, an acronym for **"A Mathematical Programming Language"**, is an algebraic modeling language for describing and solving high-complexity problems for large-scale mathematical computation (i.e. large-scale optimization and scheduling-type problems).^{[1]} It was developed by Robert Fourer, David Gay and Brian Kernighan at Bell Laboratories. AMPL supports dozens of solvers, both open source and commercial, including CBC, CPLEX, FortMP, Gurobi, MINOS, IPOPT, SNOPT, KNITRO, and LGO. Problems are passed to solvers as nl files. AMPL is used by more than a hundred corporate clients. It is also used by government agencies and academic institutions.^{[2]}

One particular advantage of AMPL is the similarity of its syntax to the mathematical notation of optimization problems. This allows for a very concise and readable definition of problems in the domain of optimization. Many modern solvers available on the NEOS^{[3]} server (formerly hosted at the Argonne National Laboratory, currently hosted at the University of Wisconsin, Madison^{[4]}) accept AMPL input. According to the NEOS statistics AMPL is the most popular format for representing mathematical programming problems.

## Contents

## Features

AMPL features a mixture of declarative and imperative programming styles. Formulation of optimization models takes place through declarative language elements such as sets, scalar and multidimensional parameters, decision variables, objectives and constraints, which allow for a concise description of most problems in the domain of mathematical optimization.

Procedures and control flow statements are available in AMPL for

- the exchange of data with external data sources such as spreadsheets, databases, XML and text files
- data pre- and post-processing tasks around optimization models
- the construction of hybrid algorithms for problem types for which no direct efficient solvers are available.

To support re-use and simplify construction of large-scale optimization problems, AMPL allows separation of model and data.

AMPL supports a wide range of problem types, among them:

- Linear programming
- Quadratic programming
- Nonlinear programming
- Mixed-integer programming
- Mixed-integer quadratic programming with or without convex quadratic constraints
- Mixed-integer nonlinear programming
- Second-order cone programming
- Global optimization
- Semidefinite programming problems with bilinear matrix inequalities
- Complementarity problems (MPECs) in discrete or continuous variables
- Constraint programming
^{[5]}

AMPL invokes a solver in a separate process which has the following advantages:

- User can interrupt the solution process at any time
- Solver errors do not affect the interpreter
- 32-bit version of AMPL can be used with a 64-bit solver and vice versa

Interaction with the solver is done through a well-defined nl interface.

## Availability

AMPL is available for many popular 32- and 64-bit platforms including Linux, Mac OS X and Windows. The translator is proprietary software maintained by AMPL Optimization LLC. However, several online services exist, providing free modeling and solving facilities using AMPL.^{[3]}^{[6]} A free student version with limited functionality and a free full-featured version for academic courses are also available.^{[7]}

AMPL can be used from within Microsoft Excel via the SolverStudio Excel add-in.

The AMPL Solver Library (ASL), which allows to read the nl files and provides the automatic differentiation, functionality is open-source. It is used in many solvers to implement AMPL connection.

## Status history

This table present significant steps in AMPL history.

Year | Highlights |
---|---|

1985 | AMPL was designed and implemented^{[1]} |

1990 | Paper describing the AMPL modeling language was published in Management Science^{[8]} |

1991 | AMPL supports nonlinear programming and automatic differentiation |

1993 | Robert Fourer, David Gay and Brian Kernighan were awarded ORSA/CSTS Prize^{[9]} by the Operations Research Society of America, for writings on the design of mathematical programming systems and the AMPL modeling language |

1995 | Extensions for representing piecewise-linear and network structures |

1995 | Scripting constructs |

1997 | Enhanced support for nonlinear solvers |

1998 | AMPL supports complementarity problems |

2000 | Relational database and spreadsheet access |

2002 | Support for constraint programming^{[5]} |

2003 | AMPL Optimization LLC was founded by the inventors of AMPL, Robert Fourer, David Gay, and Brian Kernighan. The new company took over the development and support of the AMPL modeling language from Lucent Technologies, Inc. |

2005 | AMPL Modeling Language Google group opened^{[10]} |

2008 | Kestrel: An AMPL Interface to the NEOS Server introduced |

2012 | Robert Fourer, David Gay and Brian Kernighan were awarded the 2012 INFORMS Impact Prize as the originators of one of the most important algebraic modeling languages.^{[11]} |

2012 | AMPL book becomes freely available online |

2013 | A new cross-platform integrated development environment (IDE) for AMPL becomes available^{[12]} |

## A sample model

A transportation problem from George Dantzig is used to provide a sample AMPL model. This problem finds the least cost shipping schedule that meets requirements at markets and supplies at factories.

Dantzig, G B, chapter 3.3 in *Linear Programming and Extensions*, Princeton University Press, Princeton, New Jersey, 1963.

set Plants; set Markets;# Capacity of plant p in casesparam Capacity{p in Plants};# Demand at market m in casesparam Demand{m in Markets};# Distance in thousands of milesparam Distance{Plants, Markets};# Freight in dollars per case per thousand milesparam Freight;# Transport cost in thousands of dollars per caseparam TransportCost{p in Plants, m in Markets} := Freight * Distance[p, m] / 1000;# Shipment quantities in casesvar shipment{Plants, Markets} >= 0;# Total transportation costs in thousands of dollarsminimize cost: sum{p in Plants, m in Markets} TransportCost[p, m] * shipment[p, m];# Observe supply limit at plant ps.t. supply{p in Plants}: sum{m in Markets} shipment[p, m] <= Capacity[p];# Satisfy demand at market ms.t. demand{m in Markets}: sum{p in Plants} shipment[p, m] >= Demand[m]; data; set Plants := seattle san-diego; set Markets := new-york chicago topeka; param Capacity := seattle 350 san-diego 600; param Demand := new-york 325 chicago 300 topeka 275; param Distance : new-york chicago topeka := seattle 2.5 1.7 1.8 san-diego 2.5 1.8 1.4; param Freight := 90;

## Solvers

Here is an incomplete list of solvers supported by AMPL:^{[13]}

Solver | Supported problem types |
---|---|

APOPT | mixed integer nonlinear programming |

Bonmin | mixed integer nonlinear programming |

BPMPD | linear and quadratic programming |

CBC | mixed integer programming |

CLP | linear programming |

CONOPT | nonlinear programming |

Couenne^{[14]} |
mixed-integer nonlinear programming (MINLP) |

CPLEX | linear, quadratic, second-order cone and mixed integer programming |

CPLEX CP Optimizer^{[15]} |
constraint programming |

FILTER | nonlinear programming |

FortMP | linear, quadratic and mixed integer programming |

Gecode^{[16]} |
constraint programming |

Gurobi | linear, quadratic, second-order cone and mixed integer programming |

IPOPT | nonlinear programming |

JaCoP^{[17]} |
constraint programming |

KNITRO | linear, quadratic and nonlinear programming |

LGO^{[18]} |
global and local nonlinear optimization |

LocalSolver^{[19]} |
mixed integer nonlinear programming |

lp_solve^{[20]} |
linear and mixed integer programming |

MINOS | linear and nonlinear programming |

MINTO | mixed integer programming |

MOSEK | linear, mixed integer linear, quadratic, mixed integer quadratic, quadratically constrained, conic and convex nonlinear programming |

SCIP | mixed integer programming |

SNOPT | nonlinear programming |

Sulum^{[21]} |
linear and mixed integer programming |

WORHP | nonlinear programming |

XA | linear and mixed integer programming |

Xpress | linear, quadratic and mixed integer linear programming |

## See also

## References

- ↑
^{1.0}^{1.1}Fourer, Robert; Brian W. Kernighan (2002).*AMPL: A Modeling Language for Mathematical Programming*. Duxbury Press. ISBN 978-0-534-38809-6. - ↑ "Position Available". Retrieved 2011-07-29.
- ↑
^{3.0}^{3.1}"NEOS Server for Optimization". Retrieved 11 August 2015. - ↑ "About". Retrieved 11 August 2015.
- ↑
^{5.0}^{5.1}Fourer, Robert; Gay, David M. (2002). "Extending an Algebraic Modeling Language to Support Constraint Programming".*INFORMS Journal on Computing*.**14**(4): 322–344. doi:10.1287/ijoc.14.4.322.2825. - ↑ "Try AMPL!". Retrieved 11 August 2015.
- ↑ "AMPL Downloads". Retrieved 11 August 2015.
- ↑ Fourer, Robert; Gay, David M.; Kernighan, Brian W. (1990). "A Modeling Language for Mathematical Programming" (PDF).
*Management Science*.**36**(5): 519–554–83. doi:10.1287/mnsc.36.5.519. - ↑ INFORMS. "ICS - INFORMS" (PDF). Retrieved 11 August 2015.
- ↑ http://groups.google.com/group/ampl
- ↑ INFORMS. "INFORMS Impact Prize". Retrieved 11 August 2015.
- ↑ "Google Groups". Retrieved 11 August 2015.
- ↑ "Solvers - AMPL". Retrieved 11 August 2015.
- ↑ https://projects.coin-or.org/Couenne
- ↑ "mp/solvers/ilogcp at master · ampl/mp · GitHub".
*GitHub*. Retrieved 11 August 2015. - ↑ "mp/solvers/gecode at master · ampl/mp · GitHub".
*GitHub*. Retrieved 11 August 2015. - ↑ "mp/solvers/jacop at master · ampl/mp · GitHub".
*GitHub*. Retrieved 11 August 2015. - ↑ "LGO - AMPL". Retrieved 11 August 2015.
- ↑ "mp/solvers/localsolver at master · ampl/mp · GitHub".
*GitHub*. Retrieved 11 August 2015. - ↑ "Using lpsolve from AMPL". Retrieved 11 August 2015.
- ↑ "mp/solvers/sulum at master · ampl/mp · GitHub".
*GitHub*. Retrieved 11 August 2015.

## External links

- AMPL home page
- Prof. Fourer's home page
^{[dead link]}at Northwestern University

- Pages with broken file links
- Pages using deprecated image syntax
- Articles with dead external links from September 2014
- Computer algebra systems
- Mathematical optimization
- Mathematical optimization software
- Numerical programming languages
- Mathematical modeling
- Scripting languages
- Text-oriented programming languages
- 1990 software