Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Changed: | ||||||||
< < | <-- Under Construction --> | |||||||
> > | <-- Ready to Review --> | |||||||
Looping in AMPL | ||||||||
Added: | ||||||||
> > | ||||||||
for Loops | ||||||||
Line: 41 to 42 | ||||||||
let {n in NODES : ('Chicago', n) in ARCS} Min['Chicago', n] := max(1000, Min['Chicago', n]); | ||||||||
Added: | ||||||||
> > | Return to top
Conditional Loops | |||||||
Added: | ||||||||
> > | AMPL also provides syntax for repeating a loop depending on a condition (often known as while loops). These loops use a condition, the repeat keyword, the while or until keyword and the { and } operators:
repeat while <expression> { <loop statements;> }; repeat until <expression> { <loop statements;> }; | |||||||
Changed: | ||||||||
< < | Conditional Loops
AMPL allows us to repeat a loop depending on a condition.
Syntax: We can loop subject to a condition using the repeat keyword, the while or until keyword and the { and } operators.
repeat while | |||||||
> > | These statements check the expression before executing the loop statements. The first one continues while the expression is true, the second terminates when the expression is true. AMPL provides loops that check the expression after the loop completes:
repeat { <loop statements;> } while <expression>; repeat { <loop statements;> } until <expression>;As before, the first loop continues while the expression is true, the second terminates when the expression is true. | |||||||
Added: | ||||||||
> > | Examples coming soon! | |||||||
Added: | ||||||||
> > | Return to top | |||||||
Deleted: | ||||||||
< < | ???Using symbolic parameters to do conditional loops over sets (see symbolic parameters)??? | |||||||
-- TWikiAdminGroup - 18 Mar 2008 \ No newline at end of file |