 
Summary: Introduction to AMPL
A Tutorial
January 22, 2003
AMPL is a powerful language designed specifically for mathematical programming. AMPL has many
features and options; however this tutorial covers a small subset of these1
. Sections 1 through 5 provide an in
troduction to modeling Linear Programming (LP) problems with AMPL. Sections 6 and 7 introduce AMPL's
modeling capabilities for Integer Programming (IP) and Nonlinear Programming (NLP), respectively.
1 A Simple LP Model
Consider the following example. Berkeley Paint Company makes two colors of paint, blue and gold. The blue
paint sells for $10 per gallon, while the gold paint sells for $15 per gallon. The company has one factory, and
can make only one color of paint at a time. However, blue paint is easier to make so the factory can make
40 gallons per hour of blue paint, but only 30 gallons per hour of gold paint. In addition, the marketing
department tells manufacturing that they can sell at most 860 gallons of gold paint and 1000 gallons of blue
paint. If a week is 40 hours and paint can't be stored until next week, we need to determine how many
gallons of blue and gold paint to make; so that the total revenue is maximized.
Let PaintB represent the gallons of blue paint we will make, and PaintG represent the gallons of gold
paint we will make. Then the problem is formulated as the following LP:
max 10PaintB + 15PaintG
s.t. : (1/40)PaintB + (1/30)PaintG 40
