Difference: LoopingInAMPL (2 vs. 3)

Revision 32008-03-18 - TWikiAdminUser

Line: 1 to 1
 
META TOPICPARENT name="AMPLSyntax"
<-- Under Construction -->
Line: 24 to 24
 }
Added:
>
>
Examples coming soon!

Return to top

 

let Loops

Deleted:
<
<
Coming soon!
 
Changed:
<
<

Under Construction>

>
>
In AMPL you can display and/or print over specified subsets and you can also "loop" over a let statement. To assign values for an entire set you use the let keyword, the set and the := operator:
let {e in SET} <parameter, usually involving e> := <expression, often involving e>;
 
Changed:
<
<
“Looping” let Statements In the same way you can printf over specified subsets, you can use a let statement to “loop” over a set and change the data. Syntax: To change data values for a set you use the let keyword, the set and the := operator let {e in SET} <parameter, usually involving e> := <expression, often involving e>; Consider the following possibility for American Steel. American Steel can get a 5% discount with their transportation provider out of Chicago as long as they commit to at least 1000 tonnes along each route. This change can be easily incorporated using two “looping” let statements.
>
>
Consider the following possibility for the American Steel . American Steel can get a 5% discount with their transportation provider out of Chicago as long as they commit to at least 1000 tonnes along each route. This change can be easily incorporated using two “looping” let statements.
 let {n in NODES : (‘Chicago’, n) in ARCS} Cost[‘Chicago’, n] := 0.95 * Cost[‘Chicago’, n]; let {n in NODES : (‘Chicago’, n) in ARCS}
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback