Specifying Data in AMPL

One-dimensional sets

Note: If a string in the list includes any characters other than letters, digits, underscores, period, +, and -, it must be enclosed in quotes. A string looks likea number must also be quoted.

Model: set AREA {PROD};

Two-dimensional sets

Model : set ORIG; set DEST; set LINKS with {ORIG, DEST};

Higher-dimensional sets

Model: set ROUTES within {ORIG, DEST, PROD};

One-dimensional parameters

Unindexed parameters


Indexed parameters

Model: set PROD; param rate {PROD} > 0;



Two-dimensional parameters

Model: set ORIG; set DEST; param cost {ORIG,DEST} >=0;


Note: A dot(.) indicates that "no value specified here". You can use a different symbol, say "--", by including the following statement in the data:


Higher-dimensional parameters:

Default values: