| Introduction |  | xv |  | 
| 
|  | Production Models: Maximizing Profits |  |  | 1 | (26) | 
| 
|  | A two-variable linear program |  |  | 2 | (3) | 
| 
|  | The two-variable linear program in AMPL |  |  | 5 | (1) | 
| 
|  | A linear programming model |  |  | 6 | (1) | 
| 
|  | The linear programming model in AMPL |  |  | 7 | (6) | 
|  |  | 8 | (2) | 
|  |  | 10 | (2) | 
|  |  | 12 | (1) | 
| 
|  | Adding lower bounds to the model |  |  | 13 | (2) | 
| 
|  | Adding resource constraints to the model |  |  | 15 | (3) | 
|  |  | 18 | (9) | 
| 
|  | Diet and Other Input Models: Minimizing Costs |  |  | 27 | (16) | 
| 
|  | A linear program for the diet problem |  |  | 27 | (3) | 
| 
|  | An AMPL model for the diet problem |  |  | 30 | (2) | 
| 
|  | Using the AMPL diet model |  |  | 32 | (5) | 
| 
|  | Generalizations to blending, economics and scheduling |  |  | 37 | (6) | 
| 
|  | Transportation and Assignment Models |  |  | 43 | (12) | 
| 
|  | A linear program for the transportation problem |  |  | 44 | (1) | 
| 
|  | An AMPL model for the transportation problem |  |  | 45 | (4) | 
| 
|  | Other interpretations of the transportation model |  |  | 49 | (6) | 
|  |  | 55 | (18) | 
| 
|  | A multicommodity transportation model |  |  | 56 | (3) | 
| 
|  | A multiperiod production model |  |  | 59 | (4) | 
| 
|  | A model of production and transportation |  |  | 63 | (10) | 
|  |  | 73 | (18) | 
|  |  | 73 | (2) | 
|  |  | 75 | (1) | 
|  |  | 76 | (2) | 
| 
|  | Set membership operations and functions |  |  | 78 | (1) | 
|  |  | 79 | (3) | 
|  |  | 82 | (9) | 
| 
|  | Predefined sets and interval expressions |  |  | 86 | (5) | 
| 
|  | Compound Sets and Indexing |  |  | 91 | (18) | 
|  |  | 91 | (2) | 
| 
|  | Subsets and slices of ordered pairs |  |  | 93 | (3) | 
|  |  | 96 | (2) | 
| 
|  | Operations on sets of tuples |  |  | 98 | (2) | 
| 
|  | Indexed collections of sets |  |  | 100 | (9) | 
| 
|  | Parameters and Expressions |  |  | 109 | (20) | 
|  |  | 110 | (1) | 
|  |  | 111 | (3) | 
| 
|  | Logical and conditional expressions |  |  | 114 | (2) | 
| 
|  | Restrictions on parameters |  |  | 116 | (2) | 
|  |  | 118 | (3) | 
| 
|  | Randomly generated parameters |  |  | 121 | (1) | 
|  |  | 122 | (1) | 
|  |  | 123 | (6) | 
| 
|  | Linear Programs: Variables, Objectives and Constraints |  |  | 129 | (14) | 
|  |  | 129 | (3) | 
|  |  | 132 | (2) | 
|  |  | 134 | (3) | 
|  |  | 137 | (6) | 
|  |  | 143 | (26) | 
| 
|  | Formatted data: the data command |  |  | 143 | (2) | 
|  |  | 145 | (9) | 
| 
|  | Lists of one-dimensional sets and parameters |  |  | 145 | (1) | 
| 
|  | Lists of two-dimensional sets and parameters |  |  | 146 | (2) | 
| 
|  | Lists of higher-dimensional sets and parameters |  |  | 148 | (3) | 
| 
|  | Combined lists of sets and parameters |  |  | 151 | (3) | 
|  |  | 154 | (6) | 
|  |  | 154 | (2) | 
| 
|  | Two-dimensional slices of higher-dimensional data |  |  | 156 | (1) | 
| 
|  | Higher-dimensional tables |  |  | 157 | (2) | 
|  |  | 159 | (1) | 
| 
|  | Other features of data statements |  |  | 160 | (3) | 
|  |  | 160 | (1) | 
| 
|  | Indexed collections of sets |  |  | 161 | (1) | 
| 
|  | Initial values for variables |  |  | 162 | (1) | 
| 
|  | Reading unformatted data: the read command |  |  | 163 | (6) | 
|  |  | 169 | (34) | 
| 
|  | General principles of data correspondence |  |  | 169 | (5) | 
| 
|  | Examples of table-handling statements |  |  | 174 | (6) | 
| 
|  | Reading data from relational tables |  |  | 180 | (6) | 
|  |  | 180 | (2) | 
| 
|  | Reading a set and parameters |  |  | 182 | (2) | 
| 
|  | Establishing correspondences |  |  | 184 | (1) | 
|  |  | 185 | (1) | 
| 
|  | Writing data to relational tables |  |  | 186 | (5) | 
| 
|  | Writing rows inferred from the data specifications |  |  | 186 | (3) | 
| 
|  | Writing rows inferred from a key specification |  |  | 189 | (2) | 
| 
|  | Reading and writing the same table |  |  | 191 | (2) | 
| 
|  | Reading and writing using two table declarations |  |  | 192 | (1) | 
| 
|  | Reading and writing using the same table declaration |  |  | 193 | (1) | 
| 
|  | Indexed collections of tables and columns |  |  | 193 | (4) | 
| 
|  | Indexed collections of tables |  |  | 193 | (3) | 
| 
|  | Indexed collections of data columns |  |  | 196 | (1) | 
| 
|  | Standard and built-in table handlers |  |  | 197 | (6) | 
| 
|  | Using the standard ODBC table handler |  |  | 198 | (2) | 
| 
|  | Using the standard ODBC table handler with Access and Excel |  |  | 200 | (1) | 
| 
|  | Built-in table handlers for text and binary files |  |  | 201 | (2) | 
|  |  | 203 | (16) | 
| 
|  | General principles of commands and options |  |  | 203 | (3) | 
|  |  | 204 | (1) | 
|  |  | 204 | (2) | 
| 
|  | Setting up and solving models and data |  |  | 206 | (3) | 
|  |  | 206 | (1) | 
|  |  | 207 | (2) | 
|  |  | 209 | (3) | 
|  |  | 209 | (1) | 
|  |  | 209 | (1) | 
|  |  | 210 | (2) | 
|  |  | 212 | (7) | 
| 
|  | Removing or redefining model components |  |  | 213 | (1) | 
| 
|  | Changing the model: fix, unfix; drop, restore |  |  | 214 | (1) | 
|  |  | 215 | (4) | 
|  |  | 219 | (36) | 
| 
|  | Browsing through results: the display command |  |  | 219 | (8) | 
|  |  | 220 | (1) | 
| 
|  | Displaying parameters and variables |  |  | 220 | (4) | 
| 
|  | Displaying indexed expressions |  |  | 224 | (3) | 
| 
|  | Formatting options for display |  |  | 227 | (5) | 
| 
|  | Arrangement of lists and tables |  |  | 227 | (2) | 
|  |  | 229 | (2) | 
|  |  | 231 | (1) | 
| 
|  | Numeric options for display |  |  | 232 | (6) | 
| 
|  | Appearance of numeric values |  |  | 233 | (3) | 
| 
|  | Rounding of solution values |  |  | 236 | (2) | 
| 
|  | Other output commands: print and printf |  |  | 238 | (2) | 
|  |  | 238 | (1) | 
|  |  | 239 | (1) | 
|  |  | 240 | (5) | 
|  |  | 240 | (1) | 
|  |  | 241 | (2) | 
| 
|  | Dual values and reduced costs |  |  | 243 | (2) | 
| 
|  | Other display features for models and instances |  |  | 245 | (6) | 
| 
|  | Displaying model components: the show command: |  |  | 246 | (1) | 
| 
|  | Displaying model dependencies: the xref command |  |  | 247 | (1) | 
| 
|  | Displaying model instances: the expand command |  |  | 247 | (2) | 
| 
|  | Generic synonyms for variables, constraints and objectives |  |  | 249 | (1) | 
|  |  | 250 | (1) | 
| 
|  | General facilities for manipulating output |  |  | 251 | (4) | 
|  |  | 251 | (1) | 
|  |  | 251 | (1) | 
|  |  | 252 | (3) | 
|  |  | 255 | (20) | 
| 
|  | Running scripts: include and commands |  |  | 255 | (3) | 
| 
|  | Iterating over a set: the for statement |  |  | 258 | (4) | 
| 
|  | Iterating subject to a condition: the repeat statement |  |  | 262 | (2) | 
| 
|  | Testing a condition: the if-then-else statement |  |  | 264 | (2) | 
| 
|  | Terminating a loop: break and continue |  |  | 266 | (2) | 
| 
|  | Stepping through a script |  |  | 268 | (2) | 
| 
|  | Manipulating character strings |  |  | 270 | (5) | 
| 
|  | String functions and operators |  |  | 270 | (3) | 
| 
|  | String expressions in AMPL commands |  |  | 273 | (2) | 
| 
|  | Interactions with Solvers |  |  | 275 | (44) | 
|  |  | 275 | (7) | 
| 
|  | Activities of the presolve phase |  |  | 276 | (2) | 
| 
|  | Controlling the effects of presolve |  |  | 278 | (1) | 
| 
|  | Detecting infeasibility in presolve |  |  | 279 | (3) | 
| 
|  | Retrieving results from solvers |  |  | 282 | (13) | 
|  |  | 282 | (4) | 
| 
|  | Solver statuses of objectives and problems |  |  | 286 | (1) | 
| 
|  | Solver statuses of variables |  |  | 287 | (4) | 
| 
|  | Solver statuses of constraints |  |  | 291 | (2) | 
|  |  | 293 | (2) | 
| 
|  | Exchanging information with solvers via suffixes |  |  | 295 | (9) | 
| 
|  | User-defined suffixes: integer programming directives |  |  | 296 | (2) | 
| 
|  | Solver-defined suffixes: sensitivity analysis |  |  | 298 | (1) | 
| 
|  | Solver-defined suffixes: infeasibility diagnosis |  |  | 299 | (1) | 
| 
|  | Solver-defined suffixes: direction of unboundedness |  |  | 300 | (2) | 
| 
|  | Defining and using suffixes |  |  | 302 | (2) | 
| 
|  | Alternating between models |  |  | 304 | (5) | 
|  |  | 309 | (10) | 
|  |  | 311 | (3) | 
|  |  | 314 | (1) | 
| 
|  | Displaying named problems |  |  | 315 | (1) | 
| 
|  | Defining and using named environments |  |  | 316 | (3) | 
|  |  | 319 | (34) | 
| 
|  | Minimum-cost transshipment models |  |  | 319 | (9) | 
| 
|  | A general transshipment model |  |  | 320 | (3) | 
| 
|  | Specialized transshipment models |  |  | 323 | (3) | 
| 
|  | Variations on transshipment models |  |  | 326 | (2) | 
|  |  | 328 | (5) | 
|  |  | 328 | (1) | 
|  |  | 329 | (1) | 
| 
|  | Transportation and assignment models |  |  | 330 | (3) | 
| 
|  | Declaring network models by node and arc |  |  | 333 | (7) | 
| 
|  | A general transshipment model |  |  | 334 | (1) | 
| 
|  | A specialized transshipment model |  |  | 335 | (1) | 
| 
|  | Variations on transshipment models |  |  | 336 | (1) | 
|  |  | 337 | (3) | 
| 
|  | Rules for node and arc declarations |  |  | 340 | (3) | 
|  |  | 340 | (1) | 
|  |  | 340 | (1) | 
| 
|  | Interaction with objective declarations |  |  | 341 | (1) | 
| 
|  | Interaction with constraint declarations |  |  | 342 | (1) | 
| 
|  | Interaction with variable declarations |  |  | 342 | (1) | 
| 
|  | Solving network linear programs |  |  | 343 | (10) | 
|  |  | 353 | (12) | 
|  |  | 354 | (5) | 
| 
|  | Formulation by constraints |  |  | 354 | (1) | 
|  |  | 355 | (2) | 
| 
|  | Refinements of the columnwise formulation |  |  | 357 | (2) | 
|  |  | 359 | (3) | 
| 
|  | Rules for columnwise formulations |  |  | 362 | (3) | 
| 
|  | Piecewise-Linear Programs |  |  | 365 | (26) | 
|  |  | 366 | (3) | 
|  |  | 366 | (2) | 
| 
|  | Varying numbers of pieces |  |  | 368 | (1) | 
| 
|  | Common two-piece and three-piece terms |  |  | 369 | (10) | 
| 
|  | Penalty terms for ``soft'' constraints |  |  | 369 | (4) | 
| 
|  | Dealing with infeasibility |  |  | 373 | (4) | 
|  |  | 377 | (2) | 
| 
|  | Other piecewise-linear functions |  |  | 379 | (3) | 
| 
|  | Guidelines for piecewise-linear optimization |  |  | 382 | (9) | 
| 
|  | Forms for piecewise-linear expressions |  |  | 382 | (1) | 
| 
|  | Suggestions for piecewise-linear models |  |  | 383 | (8) | 
|  |  | 391 | (28) | 
|  |  | 392 | (5) | 
| 
|  | Dropping a linearity assumption |  |  | 393 | (3) | 
| 
|  | Achieving a nonlinear effect |  |  | 396 | (1) | 
| 
|  | Modeling an inherently nonlinear process |  |  | 397 | (1) | 
|  |  | 397 | (3) | 
| 
|  | Initial values of variables |  |  | 398 | (1) | 
| 
|  | Automatic substitution of variables |  |  | 399 | (1) | 
|  |  | 400 | (3) | 
| 
|  | Pitfalls of nonlinear programming |  |  | 403 | (16) | 
| 
|  | Function range violations |  |  | 403 | (4) | 
|  |  | 407 | (3) | 
|  |  | 410 | (9) | 
|  |  | 419 | (18) | 
| 
|  | Sources of complementarity |  |  | 419 | (8) | 
| 
|  | A complementarity model of production economics |  |  | 420 | (3) | 
| 
|  | Complementarity for bounded variables |  |  | 423 | (2) | 
| 
|  | Complementarity for price-dependent demands |  |  | 425 | (1) | 
| 
|  | Other complementarity models and applications |  |  | 426 | (1) | 
| 
|  | Forms of complementarity constraints |  |  | 427 | (1) | 
| 
|  | Working with complementarity constraints |  |  | 428 | (9) | 
|  |  | 428 | (1) | 
|  |  | 429 | (2) | 
|  |  | 431 | (6) | 
|  |  | 437 | (16) | 
|  |  | 438 | (1) | 
| 
|  | Zero-one variables and logical conditions |  |  | 439 | (9) | 
|  |  | 440 | (4) | 
| 
|  | Zero-or-minimum restrictions |  |  | 444 | (1) | 
|  |  | 445 | (3) | 
| 
|  | Practical considerations in integer programming |  |  | 448 | (5) | 
| Appendix A. AMPL Reference Manual |  | 453 | (48) | 
|  |  | 453 | (1) | 
|  |  | 454 | (1) | 
| 
|  | A.3 Indexing expressions and subscripts |  |  | 455 | (1) | 
|  |  | 455 | (6) | 
|  |  | 458 | (1) | 
| 
|  | A.4.2 Strings and regular expressions |  |  | 459 | (1) | 
| 
|  | A.4.3 Piecewise-linear terms |  |  | 460 | (1) | 
| 
|  | A.5 Declarations of model entities |  |  | 461 | (1) | 
|  |  | 461 | (4) | 
| 
|  | A.6.1 Cardinality and arity functions |  |  | 462 | (1) | 
|  |  | 463 | (1) | 
| 
|  | A.6.3 Intervals and other infinite sets |  |  | 463 | (2) | 
| 
|  | A.7 Parameter declarations |  |  | 465 | (1) | 
|  |  | 465 | (1) | 
|  |  | 466 | (1) | 
| 
|  | A.8 Variable declarations |  |  | 466 | (2) | 
|  |  | 467 | (1) | 
| 
|  | A.9 Constraint declarations |  |  | 468 | (2) | 
| 
|  | A.9.1 Complementarity constraints |  |  | 469 | (1) | 
| 
|  | A.10 Objective declarations |  |  | 470 | (1) | 
| 
|  | A.11 Suffix notation for auxiliary values |  |  | 470 | (3) | 
| 
|  | A.11.1 Suffix declarations |  |  | 471 | (2) | 
|  |  | 473 | (1) | 
| 
|  | A.12 Standard data format |  |  | 473 | (4) | 
|  |  | 473 | (2) | 
|  |  | 475 | (2) | 
| 
|  | A.13 Database access and tables |  |  | 477 | (2) | 
| 
|  | A.14 Command language overview |  |  | 479 | (2) | 
| 
|  | A.14.1 Options and environment variables |  |  | 481 | (1) | 
| 
|  | A.15 Redirection of input and output |  |  | 481 | (1) | 
| 
|  | A.16 Printing and display commands |  |  | 482 | (2) | 
|  |  | 484 | (1) | 
|  |  | 485 | (6) | 
|  |  | 485 | (2) | 
| 
|  | A.18.2 The solution command |  |  | 487 | (1) | 
|  |  | 487 | (1) | 
|  |  | 487 | (1) | 
| 
|  | A.18.5 Changing a model: delete, purge, redeclare |  |  | 488 | (1) | 
| 
|  | A.18.6 The drop, restore and objective commands |  |  | 489 | (1) | 
| 
|  | A.18.7 The fix and unfix commands |  |  | 489 | (1) | 
| 
|  | A.18.8 Named problems and environments |  |  | 489 | (1) | 
| 
|  | A.18.9 Modifying data: reset, update, let |  |  | 490 | (1) | 
|  |  | 491 | (1) | 
|  |  | 491 | (1) | 
|  |  | 492 | (1) | 
| 
|  | A.19.3 The expand command |  |  | 492 | (1) | 
|  |  | 492 | (1) | 
|  |  | 492 | (1) | 
| 
|  | A.20 Scripts and control flow statements |  |  | 492 | (3) | 
| 
|  | A.20.1 The for, repeat and if-then-else statements |  |  | 493 | (2) | 
| 
|  | A.20.2 Stepping through commands |  |  | 495 | (1) | 
| 
|  | A.21 Computational environment |  |  | 495 | (2) | 
|  |  | 495 | (1) | 
|  |  | 495 | (1) | 
| 
|  | A.21.3 The quit, exit and end commands |  |  | 496 | (1) | 
| 
|  | A.21.4 Built-in timing parameters |  |  | 496 | (1) | 
|  |  | 496 | (1) | 
|  |  | 497 | (2) | 
|  |  | 499 | (2) | 
| Index |  | 501 |  |