diff --git a/Example39_Merging_Root_Events_to_Reduce_Run_Time.mp b/Example39_Merging_Root_Events_to_Reduce_Run_Time.mp new file mode 100644 index 0000000000000000000000000000000000000000..28cf824720516f298f5c3ae63df45fec9da66c2c --- /dev/null +++ b/Example39_Merging_Root_Events_to_Reduce_Run_Time.mp @@ -0,0 +1,46 @@ +/* Example39_Merging_Root_Events_to_Reduce_Run_Time.mp + + Complex MP models may have large number of root events with several +coordination operations performed on clusters of roots. This may be +system’s architecture model with a large number of actors (components) +and interactions (connectors) between them. Usually coordination operations +will be placed in schema’s body following the corresponding root event +descriptions and performed during the derivation as described in Section +3. Derivation for such “heavy†MP models in Firebird may take too much +time even for scope 1. Fortunately, the “layered derivation†strategy +implemented in MP may help to speed up the trace derivation, and in +many cases makes it possible to work with a pretty large and complex +MP models. The idea is simple – organize the derivation as a hierarchy +of smaller derivations. + + Here is an example of how to benefit from the “layered derivationâ€. +Schema S1 has several interacting root events, where roots B and C have +several coordination operations between them. These coordination operations +will be performed repeatedly each time when derivation process backtracks +and performs new top-down pass through schema’s code for the next trace +derivation. + + B and C have two coordination operations between them: COORDINATE +and SHARE ALL. To delegate this “heavy†coordination to a separate +derivation task we introduce a separate root event B_and_C to +encapsulate the trace segment derivation (including the coordination) +for B and C. + +*/ +SCHEMA Merging_Root_Events_to_Reduce_Run_Time +ROOT A: (* ( work | send_to_B) *); +ROOT B: (*<1.. $$scope + 1> +( work | receive_from_A | send_to_C ) *); +COORDINATE $a: send_to_B, +$b: receive_from_A +DO ADD $a PRECEDES $b; OD; +ROOT C: (*<1.. $$scope + 1> +( work | receive_from_B | send_to_D ) *); +COORDINATE $a: send_to_C, +$b: receive_from_B +DO ADD $a PRECEDES $b; OD; +B, C SHARE ALL work; +ROOT D: (* (work | receive_from_C ) *); +COORDINATE $a: send_to_D, +$b: receive_from_C +DO ADD $a PRECEDES $b; OD;