Skip to content
Snippets Groups Projects
Commit d2b4726b authored by Keane Reynolds's avatar Keane Reynolds
Browse files

Uploaded example 39 from the manual

parent 5d9e2c42
No related branches found
No related tags found
4 merge requests!6Keane branch,!5Keane branch,!4Keane branch,!3Keane branch
/* 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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment