Difference: VariablesInAMPL (4 vs. 5)

Revision 52008-03-02 - MichaelOSullivan

Line: 1 to 1
 
META TOPICPARENT name="AMPLSyntax"
<-- 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

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback