AMPL “Hands-On” Session

The McDonald’s Diet Problem

McDonald’s Diet Problem Data

Formulation: Too General

Formulation: Too Specific

Algebraic Model

Algebraic Model in AMPL

Data for the AMPL Model

Continuous-Variable Solution

Integer-Variable Solution

Same for 63 Foods, 12 Nutrients

Essential Modeling Language Features

Sets and Indexing

Sets of Objects

Sets of Numbers


Ordered Sets

Sets of Pairs

Sets of Pairs: Data

Sets of n-tuples

Indexed Collections of Sets

Computed Sets

Objectives and Constraints


Nonlinear Objective

Nonlinear Constraints

Nonlinear Solvers

Derivative Computations


Nondifferentiable Expressions

Lengthy Subexpressions

Lengthy Subexpressions

Common Subexpressions

Substitutions for Subexpressions

User-Defined Functions


Integer Variables

Multicommodity Model

Multicommodity Constraints

Multicommodity Optimization

Multicommodity Results


Node Declarations

Arc Declarations

Multicommodity Flows

Traveling Salesman Problem

Implied Integer Program

Data for the Integer Program

Solution (as a linear program)

Solution (showing 2 subtours)

Equivalent Integer Program

Solution (as a linear program)

Solution (optimal)

Very Important Modeling Language Features

Very Important Features (cont’d)

Complementarity Problems

Classical Linear Complementarity

Mixed Linear Complementarity

Mixed Nonlinear Complementarity

Operands to complements: always 2 inequalities


Iterative Schemes

Flow of Control

Flow of Control: Sample Output

Named Subproblems

Defining Subproblems

Switching Subproblems


Debugging (cont’d)

Internet Solver Services

The NEOS Server

NEOS Server Design

NEOS Solver Listing

Callable NEOS

Kestrel Example

Kestrel Example (cont’d)

Outline of Kestrel Operations

Other Kestrel Enhancements

Kestrel “Parallel” Processing

Database Access

Example: Diet Model

Example: Diet Data (in MS Access)

Example: Diet Script (in AMPL)

Example: Diet Results (in MS Access)