|
| 1 | +# AMPL (A Mathematical Programming Language) |
| 2 | + |
| 3 | +**AMPL** is an algebraic modeling language for describing and solving large-scale optimization and scheduling problems. Syntax is close to conventional mathematical notation; models are typically separated from data (`.mod` / `.dat` / `.run`). |
| 4 | + |
| 5 | +**Official site:** [https://www.ampl.com](https://www.ampl.com) |
| 6 | + |
| 7 | +**Not part of this engine:** idTech3 does not embed or depend on AMPL. This page is a **standalone reference** only. |
| 8 | + |
| 9 | +## Origins and license |
| 10 | + |
| 11 | +Designed by Robert Fourer, David M. Gay, and Brian W. Kernighan at Bell Labs; first appeared in 1985. The **translator** is proprietary (AMPL Optimization LLC); the **AMPL Solver Library (ASL)** for reading `.nl` files and automatic differentiation is open source. **AMPL/MP** is an open-source library for building certain solver classes. |
| 12 | + |
| 13 | +## Problem classes (examples) |
| 14 | + |
| 15 | +Linear and mixed-integer programming, quadratic and mixed-integer QP, nonlinear and MINLP, second-order cone programming, complementarity (MPECs), constraint programming, global optimization, and others depending on the linked solver. |
| 16 | + |
| 17 | +## Solver interaction |
| 18 | + |
| 19 | +AMPL normally invokes a solver in a **separate process** via a well-defined **`.nl`** interface, which isolates solver crashes from the interpreter and allows mixed 32/64-bit translator/solver combinations. |
| 20 | + |
| 21 | +## Sample model (Dantzig transportation) |
| 22 | + |
| 23 | +Classic linear program: minimize freight cost subject to plant capacity and market demand. |
| 24 | + |
| 25 | +```ampl |
| 26 | +set Plants; |
| 27 | +set Markets; |
| 28 | +
|
| 29 | +param Capacity{p in Plants}; |
| 30 | +param Demand{m in Markets}; |
| 31 | +param Distance{Plants, Markets}; |
| 32 | +param Freight; |
| 33 | +
|
| 34 | +param TransportCost{p in Plants, m in Markets} := |
| 35 | + Freight * Distance[p, m] / 1000; |
| 36 | +
|
| 37 | +var shipment{Plants, Markets} >= 0; |
| 38 | +
|
| 39 | +minimize cost: |
| 40 | + sum{p in Plants, m in Markets} TransportCost[p, m] * shipment[p, m]; |
| 41 | +
|
| 42 | +s.t. supply{p in Plants}: |
| 43 | + sum{m in Markets} shipment[p, m] <= Capacity[p]; |
| 44 | +
|
| 45 | +s.t. demand{m in Markets}: |
| 46 | + sum{p in Plants} shipment[p, m] >= Demand[m]; |
| 47 | +
|
| 48 | +data; |
| 49 | +
|
| 50 | +set Plants := seattle san-diego; |
| 51 | +set Markets := new-york chicago topeka; |
| 52 | +
|
| 53 | +param Capacity := |
| 54 | + seattle 350 |
| 55 | + san-diego 600; |
| 56 | +
|
| 57 | +param Demand := |
| 58 | + new-york 325 |
| 59 | + chicago 300 |
| 60 | + topeka 275; |
| 61 | +
|
| 62 | +param Distance : new-york chicago topeka := |
| 63 | + seattle 2.5 1.7 1.8 |
| 64 | + san-diego 2.5 1.8 1.4; |
| 65 | +
|
| 66 | +param Freight := 90; |
| 67 | +``` |
| 68 | + |
| 69 | +## Solvers (partial) |
| 70 | + |
| 71 | +AMPL supports many solvers, including open-source and commercial examples: **CBC**, **CLP**, **IPOPT**, **SCIP**, **HiGHS**, **CPLEX**, **Gurobi**, **MOSEK**, **KNITRO**, **SNOPT**, **MINOS**, **Bonmin**, **Couenne**, **Gecode**, **JaCoP**, and others. See the current list at [Solvers – AMPL](https://ampl.com/products/solvers/). |
| 72 | + |
| 73 | +## APIs and tooling |
| 74 | + |
| 75 | +Official APIs exist for **Python**, **R**, **C++**, **C#**, **MATLAB**, and **Java**. NEOS and similar services accept AMPL models remotely. |
| 76 | + |
| 77 | +## See also |
| 78 | + |
| 79 | +- [JuMP](https://jump.dev/) (Julia) |
| 80 | +- [Pyomo](http://www.pyomo.org/) (Python) |
| 81 | +- [GNU MathProg](https://www.gnu.org/software/glpk/) (GLPK subset of AMPL) |
| 82 | +- [NEOS Server](https://neos-server.org/) |
| 83 | + |
| 84 | +## References |
| 85 | + |
| 86 | +- Fourer, Gay, Kernighan, *AMPL: A Modeling Language for Mathematical Programming* (2003), Duxbury/Brooks-Cole. ISBN 978-0-534-38809-6. [Online book](https://ampl.com/resources/the-ampl-book/) |
| 87 | +- Fourer, Gay, Kernighan, “A Modeling Language for Mathematical Programming,” *Management Science* 36(5), 1990. [DOI 10.1287/mnsc.36.5.519](https://doi.org/10.1287/mnsc.36.5.519) |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +*Summary incorporates material from the Wikipedia article [“AMPL”](https://en.wikipedia.org/wiki/AMPL) (retrieved 2026); [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).* |
0 commit comments