AMPL

< >

AMPL, aka A Mathematical Programming Language, is a programming language created in 1985 by Robert Fourer and David Gay and Brian Kernighan.

 #137on PLDB 38Years Old 766Users 8Books 2Papers 6kRepos

A Mathematical Programming Language (AMPL) is an algebraic modeling language to describe and solve high-complexity problems for large-scale mathematical computing (i.e., large-scale optimization and scheduling-type problems). It was developed by Robert Fourer, David Gay, and Brian Kernighan at Bell Laboratories. AMPL supports dozens of solvers, both open source and commercial software, including CBC, CPLEX, FortMP, Gurobi, MINOS, IPOPT, SNOPT, KNITRO, and LGO. Read more on Wikipedia...

Example from the web:
```set PROD; # products param rate {PROD} > 0; # tons produced per hour param avail >= 0; # hours available in week param profit {PROD}; # profit per ton param market {PROD} >= 0; # limit on tons sold in week var Make {p in PROD} >= 0, <= market[p]; # tons produced maximize Total_Profit: sum {p in PROD} profit[p] * Make[p]; # Objective: total profits from all products subject to Time: sum {p in PROD} (1/rate[p]) * Make[p] <= avail; # Constraint: total of hours used by all # products may not exceed hours available```
Example from Linguist:
```# A toy knapsack problem from the LocalSolver docs written in AMPL. set I; param Value{I}; param Weight{I}; param KnapsackBound; var Take{I} binary; maximize TotalValue: sum{i in I} Take[i] * Value[i]; s.t. WeightLimit: sum{i in I} Take[i] * Weight[i] <= KnapsackBound; data; param: I: Weight Value := 0 10 1 1 60 10 2 30 15 3 40 40 4 30 60 5 20 90 6 20 100 7 2 15; param KnapsackBound := 102; ```
Example from Wikipedia:
```set Plants; set Markets; # Capacity of plant p in cases param Capacity{p in Plants}; # Demand at market m in cases param Demand{m in Markets}; # Distance in thousands of miles param Distance{Plants, Markets}; # Freight in dollars per case per thousand miles param Freight; # Transport cost in thousands of dollars per case param TransportCost{p in Plants, m in Markets} := Freight * Distance[p, m] / 1000; # Shipment quantities in cases var shipment{Plants, Markets} >= 0; # Total transportation costs in thousands of dollars minimize cost: sum{p in Plants, m in Markets} TransportCost[p, m] * shipment[p, m]; # Observe supply limit at plant p s.t. supply{p in Plants}: sum{m in Markets} shipment[p, m] <= Capacity[p]; # Satisfy demand at market m s.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;```

Language features

Feature Supported Token Example
Integers âœ“
`# \d+([eE][+-]?\d+)?`
Floats âœ“
`# (\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?`
Assignment âœ“ :=
`# A comment`
`# A comment`
Semantic Indentation X

title author year reviews ratings rating
Ampl: A Modeling Language for Mathematical Programming Robert Fourer 1993 0 17 4.00
AMPL: A modeling language for mathematical programming : with AMPL Plus student edition for Microsoft Windows Robert Fourer 1997 0 0 0.0
Ampl: A Modeling Language for Mathematical Programming: With Ampl Plus Student Edition for Microsoft Windows Robert Fourer 1997 0 0 0.0
Ampl: A Modeling Language for Math Programming Package (with User Guide) Robert Fourer 1999 0 1 2.00
Ampl: A Molding Language for Mathematical Programming/Book & IBM 5 1/4 Disk Robert Fourer 1991 0 0 0.0
Mathematical Optimization Software: Mathematica, General Algebraic Modeling System, Propt, Ioso, Mps, Ampl, Apmonitor, Tomsym, Worhp, Dido Source Wikipedia 2011 0 0 0.0