Cover image for AMPL : a modeling language for mathematical programming
Title:
AMPL : a modeling language for mathematical programming
Personal Author:
Edition:
2nd ed.
Publication Information:
Pacific Grove, Calif. : Thomson-Brooks/Cole, 2003
ISBN:
9780534388096

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010018812 T57.7 F68 2003 Open Access Book Book
Searching...

On Order

Summary

Summary

AMPL is a language for large-scale optimization and mathematical programming problems in production, distribution, blending, scheduling, and many other applications. Combining familiar algebraic notation and a powerful interactive command environment, AMPL makes it easy to create models, use a wide variety of solvers, and examine solutions. Though flexible and convenient for rapid prototyping and development of models, AMPL also offers the speed and generality needed for repeated large-scale production runs. This book, written by the creators of AMPL, is a complete guide for modelers at all levels of experience. It begins with a tutorial on widely used linear programming models, and presents all of AMPL's features for linear programming with extensive examples. Additional chapters cover network, nonlinear, piecewise-linear, and integer programming; database and spreadsheet interactions; and command scripts. Most chapters include exercises. Download free versions of AMPL and several solvers from www.ampl.com for experimentation, evaluation, and education. The Web site also lists vendors of the commercial version of AMPL and numerous solvers.


Table of Contents

Introductionp. xv
Chapter 1. Production Models: Maximizing Profitsp. 1
1.1 A two-variable linear programp. 2
1.2 The two-variable linear program in AMPLp. 5
1.3 A linear programming modelp. 6
1.4 The linear programming model in AMPLp. 7
The basic modelp. 8
An improved modelp. 10
Catching errorsp. 12
1.5 Adding lower bounds to the modelp. 13
1.6 Adding resource constraints to the modelp. 15
1.7 AMPL interfacesp. 18
Chapter 2. Diet and Other Input Models: Minimizing Costsp. 27
2.1 A linear program for the diet problemp. 27
2.2 An AMPL model for the diet problemp. 30
2.3 Using the AMPL diet modelp. 32
2.4 Generalizations to blending, economics and schedulingp. 37
Chapter 3. Transportation and Assignment Modelsp. 43
3.1 A linear program for the transportation problemp. 44
3.2 An AMPL model for the transportation problemp. 45
3.3 Other interpretations of the transportation modelp. 49
Chapter 4. Building Larger Modelsp. 55
4.1 A multicommodity transportation modelp. 56
4.2 A multiperiod production modelp. 59
4.3 A model of production and transportationp. 63
Chapter 5. Simple Sets and Indexingp. 73
5.1 Unordered setsp. 73
5.2 Sets of numbersp. 75
5.3 Set operationsp. 76
5.4 Set membership operations and functionsp. 78
5.5 Indexing expressionsp. 79
5.6 Ordered setsp. 82
Predefined sets and interval expressionsp. 86
Chapter 6. Compound Sets and Indexingp. 91
6.1 Sets of ordered pairsp. 91
6.2 Subsets and slices of ordered pairsp. 93
6.3 Sets of longer tuplesp. 96
6.4 Operations on sets of tuplesp. 98
6.5 Indexed collections of setsp. 100
Chapter 7. Parameters and Expressionsp. 109
7.1 Parameter declarationsp. 110
7.2 Arithmetic expressionsp. 111
7.3 Logical and conditional expressionsp. 114
7.4 Restrictions on parametersp. 116
7.5 Computed parametersp. 118
7.6 Randomly generated parametersp. 121
7.7 Logical parametersp. 122
7.8 Symbolic parametersp. 123
Chapter 8. Linear Programs: Variables, Objectives and Constraintsp. 129
8.1 Variablesp. 129
8.2 Linear expressionsp. 132
8.3 Objectivesp. 134
8.4 Constraintsp. 137
Chapter 9. Specifying Datap. 143
9.1 Formatted data: the data commandp. 143
9.2 Data in listsp. 145
Lists of one-dimensional sets and parametersp. 145
Lists of two-dimensional sets and parametersp. 146
Lists of higher-dimensional sets and parametersp. 148
Combined lists of sets and parametersp. 151
9.3 Data in tablesp. 154
Two-dimensional tablesp. 154
Two-dimensional slices of higher-dimensional datap. 156
Higher-dimensional tablesp. 157
Choice of formatp. 159
9.4 Other features of data statementsp. 160
Default valuesp. 160
Indexed collections of setsp. 161
Initial values for variablesp. 162
9.5 Reading unformatted data: the read commandp. 163
Chapter 10. Database Accessp. 169
10.1 General principles of data correspondencep. 169
10.2 Examples of table-handling statementsp. 174
10.3 Reading data from relational tablesp. 180
Reading parameters onlyp. 180
Reading a set and parametersp. 182
Establishing correspondencesp. 184
Reading other valuesp. 185
10.4 Writing data to relational tablesp. 186
Writing rows inferred from the data specificationsp. 186
Writing rows inferred from a key specificationp. 189
10.5 Reading and writing the same tablep. 191
Reading and writing using two table declarationsp. 192
Reading and writing using the same table declarationp. 193
10.6 Indexed collections of tables and columnsp. 193
Indexed collections of tablesp. 193
Indexed collections of data columnsp. 196
10.7 Standard and built-in table handlersp. 197
Using the standard ODBC table handlerp. 198
Using the standard ODBC table handler with Access and Excelp. 200
Built-in table handlers for text and binary filesp. 201
Chapter 11. Modeling Commandsp. 203
11.1 General principles of commands and optionsp. 203
Commandsp. 204
Optionsp. 204
11.2 Setting up and solving models and datap. 206
Entering models and datap. 206
Solving a modelp. 207
11.3 Modifying datap. 209
Resettingp. 209
Resamplingp. 209
The let commandp. 210
11.4 Modifying modelsp. 212
Removing or redefining model componentsp. 213
Changing the model: fix, unfix; drop, restorep. 214
Relaxing integralityp. 215
Chapter 12. Display Commandsp. 219
12.1 Browsing through results: the display commandp. 219
Displaying setsp. 220
Displaying parameters and variablesp. 220
Displaying indexed expressionsp. 224
12.2 Formatting options for displayp. 227
Arrangement of lists and tablesp. 227
Control of line widthp. 229
Suppression of zerosp. 231
12.3 Numeric options for displayp. 232
Appearance of numeric valuesp. 233
Rounding of solution valuesp. 236
12.4 Other output commands: print and printfp. 238
The print commandp. 238
The printf commandp. 239
12.5 Related solution valuesp. 240
Objective functionsp. 240
Bounds and slacksp. 241
Dual values and reduced costsp. 243
12.6 Other display features for models and instancesp. 245
Displaying model components: the show commandp. 246
Displaying model dependencies: the xref commandp. 247
Displaying model instances: the expand commandp. 247
Generic synonyms for variables, constraints and objectivesp. 249
Resource listingsp. 250
12.7 General facilities for manipulating outputp. 251
Redirection of outputp. 251
Output logsp. 251
Limits on messagesp. 252
Chapter 13. Command Scriptsp. 255
13.1 Running scripts: include and commandsp. 255
13.2 Iterating over a set: the for statementp. 258
13.3 Iterating subject to a condition: the repeat statementp. 262
13.4 Testing a condition: the if-then-else statementp. 264
13.5 Terminating a loop: break and continuep. 266
13.6 Stepping through a scriptp. 268
13.7 Manipulating character stringsp. 270
String functions and operatorsp. 270
String expressions in AMPL commandsp. 273
Chapter 14. Interactions with Solversp. 275
14.1 Presolvep. 275
Activities of the presolve phasep. 276
Controlling the effects of presolvep. 278
Detecting infeasibility in presolvep. 279
14.2 Retrieving results from solversp. 282
Solve resultsp. 282
Solver statuses of objectives and problemsp. 286
Solver statuses of variablesp. 287
Solver statuses of constraintsp. 291
AMPL statusesp. 293
14.3 Exchanging information with solvers via suffixesp. 295
User-defined suffixes: integer programming directivesp. 296
Solver-defined suffixes: sensitivity analysisp. 298
Solver-defined suffixes: infeasibility diagnosisp. 299
Solver-defined suffixes: direction of unboundednessp. 300
Defining and using suffixesp. 302
14.4 Alternating between modelsp. 304
14.5 Named problemsp. 309
Defining named problemsp. 311
Using named problemsp. 314
Displaying named problemsp. 315
Defining and using named environmentsp. 316
Chapter 15. Network Linear Programsp. 319
15.1 Minimum-cost transshipment modelsp. 319
A general transshipment modelp. 320
Specialized transshipment modelsp. 323
Variations on transshipment modelsp. 326
15.2 Other network modelsp. 328
Maximum flow modelsp. 328
Shortest path modelsp. 329
Transportation and assignment modelsp. 330
15.3 Declaring network models by node and arcp. 333
A general transshipment modelp. 334
A specialized transshipment modelp. 335
Variations on transshipment modelsp. 336
Maximum flow modelsp. 337
15.4 Rules for node and arc declarationsp. 340
node declarationsp. 340
arc declarationsp. 340
Interaction with objective declarationsp. 341
Interaction with constraint declarationsp. 342
Interaction with variable declarationsp. 342
15.5 Solving network linear programsp. 343
Chapter 16. Columnwise Formulationsp. 353
16.1 An input-output modelp. 354
Formulation by constraintsp. 354
A columnwise formulationp. 355
Refinements of the columnwise formulationp. 357
16.2 A scheduling modelp. 359
16.3 Rules for columnwise formulationsp. 362
Chapter 17. Piecewise-Linear Programsp. 365
17.1 Cost termsp. 366
Fixed numbers of piecesp. 366
Varying numbers of piecesp. 368
17.2 Common two-piece and three-piece termsp. 369
Penalty terms for "soft" constraintsp. 369
Dealing with infeasibilityp. 373
Reversible activitiesp. 377
17.3 Other piecewise-linear functionsp. 379
17.4 Guidelines for piecewise-linear optimizationp. 382
Forms for piecewise-linear expressionsp. 382
Suggestions for piecewise-linear modelsp. 383
Chapter 18. Nonlinear Programsp. 391
18.1 Sources of nonlinearityp. 392
Dropping a linearity assumptionp. 393
Achieving a nonlinear effectp. 396
Modeling an inherently nonlinear processp. 397
18.2 Nonlinear variablesp. 397
Initial values of variablesp. 398
Automatic substitution of variablesp. 399
18.3 Nonlinear expressionsp. 400
18.4 Pitfalls of nonlinear programmingp. 403
Function range violationsp. 403
Multiple local optimap. 407
Other pitfallsp. 410
Chapter 19. Complementarity Problemsp. 419
19.1 Sources of complementarityp. 419
A complementarity model of production economicsp. 420
Complementarity for bounded variablesp. 423
Complementarity for price-dependent demandsp. 425
Other complementarity models and applicationsp. 426
19.2 Forms of complementarity constraintsp. 427
19.3 Working with complementarity constraintsp. 428
Related solution valuesp. 428
Presolvep. 429
Generic synonymsp. 431
Chapter 20. Integer Linear Programsp. 437
20.1 Integer variablesp. 438
20.2 Zero-one variables and logical conditionsp. 439
Fixed costsp. 440
Zero-or-minimum restrictionsp. 444
Cardinality restrictionsp. 445
20.3 Practical considerations in integer programmingp. 448
Appendix A. AMPL Reference Manualp. 453
A.1 Lexical rulesp. 453
A.2 Set membersp. 454
A.3 Indexing expressions and subscriptsp. 455
A.4 Expressionsp. 455
A.4.1 Built-in functionsp. 458
A.4.2 Strings and regular expressionsp. 459
A.4.3 Piecewise-linear termsp. 460
A.5 Declarations of model entitiesp. 461
A.6 Set declarationsp. 461
A.6.1 Cardinality and arity functionsp. 462
A.6.2 Ordered setsp. 463
A.6.3 Intervals and other infinite setsp. 463
A.7 Parameter declarationsp. 465
A.7.1 Check statementsp. 465
A.7.2 Infinityp. 466
A.8 Variable declarationsp. 466
A.8.1 Defined variablesp. 467
A.9 Constraint declarationsp. 468
A.9.1 Complementarity constraintsp. 469
A.10 Objective declarationsp. 470
A.11 Suffix notation for auxiliary valuesp. 470
A.11.1 Suffix declarationsp. 471
A.11.2 Statusesp. 473
A.12 Standard data formatp. 473
A.12.1 Set datap. 473
A.12.2 Parameter datap. 475
A.13 Database access and tablesp. 477
A.14 Command language overviewp. 479
A.14.1 Options and environment variablesp. 481
A.15 Redirection of input and outputp. 481
A.16 Printing and display commandsp. 482
A.17 Reading datap. 484
A.18 Modeling commandsp. 485
A.18.1 The solve commandp. 485
A.18.2 The solution commandp. 487
A.18.3 The write commandp. 487
A.18.4 Auxiliary filesp. 487
A.18.5 Changing a model: delete, purge, redeclarep. 488
A.18.6 The drop, restore and objective commandsp. 489
A.18.7 The fix and unfix commandsp. 489
A.18.8 Named problems and environmentsp. 489
A.18.9 Modifying data: reset, update, letp. 490
A.19 Examining modelsp. 491
A.19.1 The show commandp. 491
A.19.2 The xref commandp. 492
A.19.3 The expand commandp. 492
A.19.4 Generic namesp. 492
A.19.5 The check commandp. 492
A.20 Scripts and control flow statementsp. 492
A.20.1 The for, repeat and if-then-else statementsp. 493
A.20.2 Stepping through commandsp. 495
A.21 Computational environmentp. 495
A.21.1 The shell commandp. 495
A.21.2 The cd commandp. 495
A.21.3 The quit, exit and end commandsp. 496
A.21.4 Built-in timing parametersp. 496
A.21.5 Loggingp. 496
A.22 Imported functionsp. 497
A.23 AMPL invocationp. 499
Indexp. 501