Tables of Contents

AMPL: A Modeling Language
for Mathematical Programming

by Robert Fourer, David M. Gay, and Brian W. Kernighan

Duxbury Press / Brooks/Cole Publishing Company, 2003

[NEW] Second edition now available
517 + xxi pp., ISBN 0-534-38809-4, $53.95


     Introduction -- download in PDF (30K), gzipped postscript (15K)

  1. Production Models: Maximizing Profits -- download in PDF (575K), gzipped postscript (971K)
  2. Diet and Other Input Models: Minimizing Costs
  3. Transportation and Assignment Models
  4. Building Larger Models

  5. Simple Sets and Indexing
  6. Compound Sets and Indexing
  7. Parameters and Expressions
  8. Linear Programs: Variables, Objectives and Constraints

  9. Specifying Data
  10. Database Access

  11. Modeling Commands
  12. Display Commands
  13. Command Scripts
  14. Interactions with Solvers

  15. Network Linear Programs
  16. Columnwise Formulations
  17. Piecewise-Linear Programs
  18. Nonlinear Programs
  19. Complementarity Problems
  20. Integer Linear Programs

    Appendix. AMPL Reference Manual

Chapters and Sections


Chapter 1. Production Models: Maximizing Profits

1.1 A two-variable linear program
1.2 The two-variable linear program in AMPL
1.3 A linear programming model
1.4 The linear programming model in AMPL
The basic model
An improved model
Catching errors
1.5 Adding lower bounds to the model
1.6 Adding resource constraints to the model
1.7 AMPL interfaces
Chapter 2. Diet and Other Input Models: Minimizing Costs

2.1 A linear program for the diet problem
2.2 An AMPL model for the diet problem
2.3 Using the AMPL diet model
2.4 Generalizations to blending, economics and scheduling
Chapter 3. Transportation and Assignment Models

3.1 A linear program for the transportation problem
3.2 An AMPL model for the transportation problem
3.3 Other interpretations of the transportation model
Chapter 4. Building Larger Models

4.1 A multicommodity transportation model
4.2 A multiperiod production model
4.3 A model of production and transportation
Chapter 5. Simple Sets and Indexing

5.1 Unordered sets
5.2 Sets of numbers
5.3 Set operations
5.4 Set membership operations and functions
5.5 Indexing expressions
5.6 Ordered sets
Predefined sets and interval expressions
Chapter 6. Compound Sets and Indexing

6.1 Sets of ordered pairs
6.2 Subsets and slices of ordered pairs
6.3 Sets of longer tuples
6.4 Operations on sets of tuples
6.5 Indexed collections of sets
Chapter 7. Parameters and Expressions

7.1 Parameter declarations
7.2 Arithmetic expressions
7.3 Logical and conditional expressions
7.4 Restrictions on parameters
7.5 Computed parameters
7.6 Randomly generated parameters
7.7 Logical parameters
7.8 Symbolic parameters
Chapter 8. Linear Programs: Variables, Objectives and Constraints

8.1 Variables
8.2 Linear expressions
8.3 Objectives
8.4 Constraints
Chapter 9. Specifying Data

9.1 Formatted data: the data command
9.2 Data in lists
Lists of one-dimensional sets and parameters
Lists of two-dimensional sets and parameters
Lists of higher-dimensional sets and parameters
Combined lists of sets and parameters
9.3 Data in tables
Two-dimensional tables
Two-dimensional slices of higher-dimensional data
Higher-dimensional tables
Choice of format
9.4 Other features of data statements
Default values
Indexed collections of sets
Initial values for variables
9.5 Reading unformatted data: the read command
Chapter 10. Database Access

10.1 General principles of data correspondence
10.2 Examples of table-handling statements
10.3 Reading data from relational tables
Reading parameters only
Reading a set and parameters
Establishing correspondences
Reading other values
10.4 Writing data to relational tables
Writing rows inferred from the data specifications
Writing rows inferred from a key specification
10.5 Reading and writing the same table
Reading and writing using two table declarations
Reading and writing using the same table declaration
10.6 Indexed collections of tables and columns
Indexed collections of tables
Indexed collections of data columns
10.7 Standard and built-in table handlers
Using the standard ODBC table handler
Using the standard ODBC table handler with Access and Excel
Built-in table handlers for text and binary files
Chapter 11. Modeling Commands

11.1 General principles of commands and options
11.2 Setting up and solving models and data
Entering models and data
Solving a model
11.3 Modifying data
The let command
11.4 Modifying models
Removing or redefining model components
Changing the model: fix, unfix; drop, restore
Relaxing integrality
Chapter 12. Display Commands

12.1 Browsing through results: the display command
Displaying sets
Displaying parameters and variables
Displaying indexed expressions
12.2 Formatting options for display
Arrangement of lists and tables
Control of line width
Suppression of zeros
12.3 Numeric options for display
Appearance of numeric values
Rounding of solution values
12.4 Other output commands
The print command
The printf command
12.5 Related solution values
Objective functions
Bounds and slacks
Dual values and reduced costs
12.6 Other display features for models and instances
Displaying model components: the show command
Displaying model dependencies: the xref command
Displaying model instances: the expand command
Generic synonyms for variables, constraints and objectives
Resource listings
12.7 General facilities for manipulating output
Redirection of output
Output logs
Limits on messages
Chapter 13. Command Scripts

13.1 Running scripts: include and commands
13.2 Iterating over a set: the for statement
13.3 Iterating subject to a condition: the repeat statement
13.4 Testing a condition: the if-then-else statement
13.5 Terminating a loop: break and continue
13.6 Stepping through a script
13.7 Manipulating character strings
String functions and operators
String expressions in AMPL commands
Chapter 14. Interactions with Solvers

14.1 Presolve
Activities of the presolve phase
Controlling the effects of presolve
Detecting infeasibility in presolve
14.2 Retrieving results from solvers
Solve results
Solver statuses of objectives and problems
Solver statuses of variables
Solver statuses of constraints
AMPL statuses
14.3 Exchanging information with solvers via suffixes
User-defined suffixes: integer programming directives
Solver-defined suffixes: sensitivity analysis
Solver-defined suffixes: infeasibility diagnosis
Solver-defined suffixes: direction of unboundedness
Defining and using suffixes
14.4 Alternating between models
14.5 Named problems
Defining named problems
Using named problems
Displaying named problems
Defining and using named environments
Chapter 15. Network Linear Programs

15.1 Minimum-cost transshipment models
A general transshipment model
Specialized transshipment models
Variations on transshipment models
15.2 Other network models
Maximum flow models
Shortest path models
Transportation and assignment models
15.3 Declaring network models by node and arc
A general transshipment model
A specialized transshipment model
Variations on transshipment models
Maximum flow models
15.4 Rules for node and arc declarations
node declarations
arc declarations
Interaction with objective declarations
Interaction with constraint declarations
Interaction with variable declarations
15.5 Solving network linear programs
Chapter 16. Columnwise Formulations

16.1 An input-output model
Formulation by constraints
A columnwise formulation
Refinements of the columnwise formulation
16.2 A scheduling model
16.3 Rules for columnwise formulations
Chapter 17. Piecewise-Linear Programs

17.1 Cost terms
Fixed numbers of pieces
Varying numbers of pieces
17.2 Common two-piece and three-piece terms
Penalty terms for "soft" constraints
Dealing with infeasibility
Reversible activities
17.3 Other piecewise-linear functions
17.4 Guidelines for piecewise-linear optimization
Forms for piecewise-linear expressions
Suggestions for piecewise-linear models
Chapter 18. Nonlinear Programs

18.1 Sources of nonlinearity
Dropping a linearity assumption
Achieving a nonlinear effect
Modeling an inherently nonlinear process
18.2 Nonlinear variables
Initial values of variables
Automatic substitution of variables
18.3 Nonlinear expressions
18.4 Pitfalls of nonlinear programming
Function range violations
Multiple local optima
Other pitfalls
Chapter 19. Complementarity Problems

19.1 Sources of complementarity
A complementarity model of production economics
Complementarity for bounded variables
Complementarity for price-dependent demands
Other complementarity models and applications
19.2 Forms of complementarity constraints
19.3 Working with complementarity constraints
Related solution values
Generic synonyms
Chapter 20. Integer Linear Programs

20.1 Integer variables
20.2 Zero-one variables and logical conditions
Fixed costs
Zero-or-minimum restrictions
Cardinality restrictions
20.3 Practical considerations in integer programming
Appendix A. AMPL Reference Manual

A.1 Lexical rules
A.2 Set members
A.3 Indexing expressions and subscripts
A.4 Expressions
A.4.1 Built-in functions
A.4.2 Strings and regular expressions
A.4.2 Piecewise-linear terms
A.5 Declarations of model entities
A.6 Set declarations
A.6.1 Cardinality and arity function
A.6.2 Ordered sets
A.6.3 Intervals and other infinite sets
A.7 Parameter declarations
A.7.1 Check statements
A.7.2 Infinity
A.8 Variable declarations
A.8.1 Defined variables
A.9 Constraint declarations
A.9.1 Complementarity constraints
A.10 Objective declarations
A.11 Suffix notation for auxiliary values
A.11.1 Suffix declarations
A.11.2 Statuses
A.12 Standard data format
A.12.1 Set data
A.12.2 Parameter data
A.13 Database access and tables
A.14 Command language overview
A.14.1 Options and environment variables
A.15 Redirection of input and output
A.16 Printing and display commands
A.17 Reading data
A.18 Modeling commands
A.18.1 The solve command
A.18.2 The solution command
A.18.3 The write command
A.18.4 Auxiliary files
A.18.5 Changing a model: delete, purge, redeclare
A.18.6 The drop, restore and objective commands
A.18.7 The fix and unfix commands
A.18.8 Named problems and environments
A.18.9 Modifying data: reset, update, let
A.19 Examining models
A.19.1 The show command
A.19.2 The xref command
A.19.3 The expand command
A.19.4 Generic names
A.19.5 The check command
A.20 Scripts and control flow statements
A.20.1 The for, repeat and if-then-else statements
A.20.2 Stepping through commands
A.21 Parameter declarations
A.21.1 The shell command
A.21.2 The cd command
A.21.3 The quit, exit and end commands
A.21.4 Built-in timing parameters
A.21.5 Logging
A.22 Imported functions
A.23 AMPL invocation

Comments or questions?
Write to info@ampl.com or use our comment form.

Back to AMPL book page.

Back to AMPL home page.