AMPL Book Examples
You can view and run the examples found in the AMPL book. The files contains instructions on how to run the solver.

Example
Book Figure(s)
Basic production model | AMPL | GLPSOL | NEOS
1-2 and 1-3
Steel production model | AMPL | GLPSOL | NEOS
1-4a and 1-4b
Lower bounds on production | AMPL | GLPSOL | NEOS
1-5a and 1-5b
Additional resource constraints | AMPL | GLPSOL | NEOS
1-6a and 1-6b
Diet model | AMPL | GLPSOL | NEOS
2-1 to 2-3
Transportation model | AMPL
3-1a and 3-1b
Multicommodity transportation model | AMPL
4-1 and 4-2
Multiperiod production model | AMPL
4-4 and 4-5
Production-transportation model | AMPL
4-6 and 4-7
Diet model using union | AMPL
5-1 and 5-2
Production model with ordered sets | AMPL
5-3 and 5-4
Transportation model with all pairs | AMPL
6-1
Transportation model with selected pairs | AMPL
6-2a and 6-2b
Multiperiod production with indexed sets | AMPL
6-3 and 6-4
Multicommodity transportation with indexed sets | AMPL
6-5
Parameter sensitivity script | AMPL
13-1
Script for printing a sales table | AMPL
13-2
Script for recording sensitivity | AMPL
13-3
Testing conditions within a loop | AMPL
13-4
Using break and continue in a loop | AMPL
13-5
Sensitivity analysis with infeasibility test | AMPL
14-1
Pattern-based model for the cutting problem | AMPL
14-2 to 14-4
Defining named problems | AMPL
14-6
General transshipment model | AMPL
15-2a and 15-2b
Specialized transshipment model | AMPL
15-3a and 15-3b
Specialized transshipment model v2 | AMPL
15-4a and 15-4b
Maximum traffic flow | AMPL
15-6
Shortest path | AMPL
15-7
General transshipment model with node and arc | AMPL
15-10
Specialized transshipment model with node and arc | AMPL
15-11
Maximum flow model with node and arc | AMPL
15-12
Columnwise scheduling model | AMPL
16-4
Piecewise-linear model with three slopes | AMPL
17-2
Piecewise-linear model with indexed slopes | AMPL
17-3a and 17-3b
Piecewise-linear objective with penalty function | AMPL
17-5a and 17-5b
Nonlinear transportation model | AMPL
18-4 and 18-5
Production cost minimization model | AMPL
19-1 and 19-2
Production equilibrium model | AMPL
19-3
Bounded version of production equilibrium model | AMPL
19-4
Price-dependent demands | AMPL
19-5
Multicommodity model with fixed costs | AMPL
20-1a and 20-1b
Multicommodity model with fixed costs v2 | AMPL
section 20.2
Multicommodity model with further restrictions | AMPL
20-2a and 20-2b