
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
<-- Ready to Review --> Variables in AMPL | ||||||||
| Line: 32 to 32 | ||||||||
| Often, you will want to create one variable for every member (respectively pair, tuple) from a set (a two-dimensional set, multi-dimensional set, respectively). To do this you simply add the set after the variable name: | ||||||||
| Added: | ||||||||
| > > |
var <varname> [{<indexname>}];
| |||||||
Example | ||||||||
| Line: 149 to 152 | ||||||||
| # Constraints: Meet the nutritional requirements subject to MeetRequirement {r in REQUIREMENTS}: | ||||||||
| Changed: | ||||||||
| < < | Min[r] <= sum {i in INGREDIENTS} Contributes[i, r] * Amount[i] <= Max[r]; | |||||||
| > > | Min[r] <= sum {i in INGREDIENTS} Contributes[i, r] * Amount[i] <= Max[r]; | |||||||
| Return to top | ||||||||