Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Always use scope 1 (default setting) to get started in your modeling.  Unlike other programming languages, note that scope settings are  controlled when you run your model.  If there are you need some restrictions on scope they are indicated separately in the model via ENSURE statements (which filter filter precluded conditions from your traces).

The various types of iteration are discussed below.






Note: The difference between the (*…*) syntax and the [ ] syntax is nothing if you run at scope one (single iteration maximum) since the [ ] really means 0 or 1 instances of this event.  So,  you run at a higher scope, Go_to_library still will run only 0 or 1 time, but Attend_class can appear any number of times up to the scope. 


"While" and "Repeat Until" Style Looping

From the MP Guide Section 2.3:


Behavior of the loop

while(Condition) do Loop_body


can be modeled (in pseudo-code) as



(* Condition_is_true 


Running this on scope 3 produces four traces: one for (never executes loop body), and then one for each number of possible iterations (as specified by scope setting) through the loop body.

The (*…*) syntax means that the loop could possibly be executed zero times.  In contrast a "repeat…until" loop is always executed at least once, which is implemented the same way as the above example, but uses the (+…+) repetition syntax.