Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gergely Varró, Frederik Deckwerth, Martin Wieber, Andy Schürr 13. Juli.

Similar presentations


Presentation on theme: "Gergely Varró, Frederik Deckwerth, Martin Wieber, Andy Schürr 13. Juli."— Presentation transcript:

1 Gergely Varró, Frederik Deckwerth, Martin Wieber, Andy Schürr 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 1 An Algorithm for Generating Model-Sensitive Search Plans for EMF Models

2 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 2 Railway Systems and Safety Requirements  Developed in the MOGENTES project [www.mogentes.eu] ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors [2] [1] Route defines SwPosSwitch observes Sensor sensors inPosition Metamodel {ordered} sw1sw2 sp ro se1se2 Ordered reference navigable in one direction

3 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 3 Ensuring Safety Requirements at Runtime by Pattern Matching  Which sensors, switches and positions must be checked for a route? ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer [2] [1] Route defines SwPosSwitch observes Sensor sensors inPosition Metamodel {ordered} sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) Constraints RO,IDX,SE,SW,SWP Variables Non-binary constraint Pattern matching sw1sw2 sp ro se1se2

4 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 4 Motivation  Pattern matcher application scenarios  On-the-fly consistency validation  Ensuring safety requirements at runtime  Application condition checks in rule-based model transformation tools  Bidirectional model synchronization ……  Pattern matcher requirements in an industrial context  Efficiency  Scalability  Standard compliance  Goal  Improve the runtime performance of pattern matching  Reduce the number of steps  Run the pattern matcher on top of EMF models

5 Search plan: a sequence of operations 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 5 Search Plan Driven Pattern Matching I. ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer roRO IDX SE SW SWP B F F F F roRO IDX SE SW spSWP B F F F B roRO IDX SE sw1SW spSWP B F F B B roRO 1IDX se1SE sw1SW spSWP B B B B B BB B F F F F [2] [1] Adornment: binding information for all variablesOperation: navigation along a defines edge from a Route to a SwPos Operation adornment: binding precondition RO and SWP must be bound and free, respectively Free variable SWP get bound by the operation BFFFF sensors(RO,IDX,SE) BFFBFFBBBFFFBBBBBBBF defines(RO,SWP)inPosition(SW,SWP) FB observes(SE,SW) (Initial) partial match Variable RO is Bound (mapped) to ro.Variables IDX, SE, SW and SWP are Free (unmapped). Pattern matcher performs 4 steps (i.e., traverses 4 matches)

6 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 6 Search Plan Driven Pattern Matching II. ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer roRO IDX SE SW SWP B F F F F roRO 1IDX se1SE SW spSWP B B B F B roRO 1IDX se1SE sw1SW spSWP B B B B B roRO 2IDX se2SE SW spSWP B B B F B roRO 2IDX se2SE sw2SW spSWP B B B B B roRO IDX SE SW spSWP B F F F B [2] [1] BFFFF sensors(RO,IDX,SE) BFFBFFBBBFFFBBBBBB observes(SE,SW) BFBBBFB BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF Pattern matcher performs 6 steps with the second search plan. Backtracking The number of pattern matching steps is influenced by the used search plan. Perform search plan optimization (before pattern matching) to reduce the number of steps (during pattern matching)

7 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 7 Search Plan Optimization Space  Each path (from BFFFF to BBBBB ) represents a search plan  Which is the best one?  Quantitative characterization needed  Weights for operations  Costs for partial search plans (i.e., path prefixes)  Goal: weights and costs characterize the pattern matching traversal process  Algorithm needed (search plan generation algorithm)  Goal: find the best search plan (w.r.t. the cost) BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF

8 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 8 Search Plan Generation Approaches  Domain-specific (DS) approaches  Operation weights and search plan costs  From the metamodel: type and multiplicity information  Independent from the model  Always the same search plan for all models  Model-sensitive (MS) approaches  Operation weights and search plan costs  From model statistics: number of objects/links of a certain type  Different search plans for different models BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF

9 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 9 Model-Sensitive Search Plan Generation Approaches [1] Giese, Hildebrandt, Seibel: Improved Flexibility and Scalability by Interpreting Story Diagrams [2] Geiß, Batz, Grund, Hack, Szalkowski: GrGen: A Fast SPO-Based Graph Rewriting Tool [3] Varró, Varró, Friedl: Adaptive Graph Pattern Matching for Model Transformations Using Model-Sensitive Search Plans Binary Cost function Supported constraints Model representation Search plan generation algorithm GrGen [2] VIATRA [3] Fujaba [1] Simple (product)OwnGraph BinarySimple (sum)OwnGraph Current approach BinaryN/AEMF Built-in greedy Arbitrary Complex (pluggable) EMF (pluggable) Dynamic programming

10 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 10 Dynamic Programming Based Search Plan Generation Algorithm  Dynamic programming  Table is filled out iteratively  Columns: number of free variables in the initial adornment (+1) BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) BFFFF has 4 free variables

11 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 11 Algorithmic Problems I.  Exponential number of adornments (2 5 )  Store only a limited number of adornments in each column  Limit  User-defined parameter of the algorithm (e.g., k=2 in our example)  Trade-off between efficiency and optimality  Number of rows defined by k BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP)

12 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 12 Algorithmic Problems II.  Unnecessary recalculations in case of shared path suffixes  Store only the best of those path prefixes that end at the same adornment  Adornment check required when inserting into the table BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF BFFFB

13 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 13 Algorithmic Problems III.  Best search plan  Sorted columns in increasing order according to the search plan costs  Search plan cost comparison required when inserting into the table BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP)

14 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 14 Algorithmic Problems IV.  Adornments without outgoing edges  Reachability analysis required when inserting into the table  Not discussed now BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP)

15 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 15 Algorithm Data Structures BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF B***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF 10 Adornment Applicable operations Operation weights (sorted in an increasing order) Search plan cost Search plan (no operations applied yet) State

16 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 16 Algorithm Initialization BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF B***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF Initial state goes to the top-left field

17 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 17 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF defines(RO,SWP) BFB***F 1 1 BFFFB  Iterative process  On the columns in decreasing order  On the rows in increasing order  On the present extension operations in weight increasing order  Each iteration creates a new state BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF

18 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 18 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 1 inPosition(SW,SWP) FB***FB 1 The new state has 3 free variables BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) observes(SE,SW) BF

19 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 19 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 10 inPosition(SW,SWP) FB***FB 1 sensors(RO,IDX,SE) BFFBFF** 2 2 BBBFF 2 BFB***F 1defines(RO,SWP) observes(SE,SW) BF**BF* 1 BFFFF BBBFF BFFBBBFFFBBF defines(RO,SWP) sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) sensors(RO,IDX,SE) BFF inPosition(SW,SWP) FB 2

20 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 20 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 10 3 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 1 inPosition(SW,SWP) FB***FB 1 2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 1

21 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 21 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 21 Same adornment? No Better search plan? No

22 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 22 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 3 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1 10

23 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 23 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBFB 2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBF 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 0 Same adornment? Yes Better search plan? No

24 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 24 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBF 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 BFB***F 1defines(RO,SWP) 3 BFBBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBB 2 observes(SE,SW) BB**BB* inPosition(SW,SWP) FB***FB 1 No valid continuation

25 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 25 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBF 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBB 2 observes(SE,SW) BB**BB* inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 5 BBBBB 2 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 5 BBBBB 2 observes(SE,SW) BF**BF* 1 sensors(RO,IDX,SE) BFFBFF** 2 5 BBBBF 1 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 sensors(RO,IDX,SE) BFFBFF** 2 6 BBBBF 2 observes(SE,SW) BF**BF* 1 BFB***F 1defines(RO,SWP) Same adornment? Better search plan? No Yes

26 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 26 Algorithm BF sensors(RO,IDX,SE) defines(RO,SWP) BFF observes(SE,SW) BB inPosition(SW,SWP) FB B***F 1 BFF** 2 4 BBBBB 2 **BB* ***FB 1 Algorithm returns the search plan in T[0][1]

27 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 27 Measurement Results I.  Eager strategy (k=1) suffices in practical cases?  Larger k can be better even for small patterns

28 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 28 Measurement Results II.  Search plan cost function makes sense  Good correlation between search plan cost and pattern matching steps

29 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 29 Measurement Results III.  Model-sensitive (MS) search plans outperform domain-specific (DS) ones  On all test models  By nearly 400 steps in average  When the pattern has many edges with arbitrary multiplicity

30 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 30 Summary  Pattern matcher  Improve runtime performance: reduced number of PM steps  Fully implemented  Flexible and embeddable into different tools  Model-sensitive search plans  Operation weights from the model  First such solution for EMF  Search plan generation algorithm  General n-ary operations  Complex cost functions (not only addition/multiplication)  Parameterization: trade-off between efficiency and optimality  Usable without the pattern matcher  Complex attribute manipulation in bidirectional transformation

31 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 31 Relative Frequency Distribution  DS is better by 6-10 steps in 1.875% of the cases  Draw in 6.875% of the cases  MS is better by steps in 10% of the cases

32 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 32 Performance Details  Search plan generation: 50 μs  1 PM step (on average): 51 ns  model elements: 109 * 51 ns = 5 μs  AST from parsed apache.org projects: 5 million elements: 36 ms

33 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 33 Summary  Pattern matcher  Improve runtime performance  Fully implemented  Embeddable into different tools  Model-sensitive search plans  Operation weights from the model  First such solution for EMF  Search plan generation algorithm (with or without pattern matcher)  General n-ary operations  Complex cost functions (not only addition/multiplication)  Parameterization  Trade-off between efficiency and optimality  Not only the eager strategy (k=1)  Larger k can be better even for small patterns  Our expectation: eager strategy suffices in practical cases

34 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 34 Dynamic Programming Based Search Plan Generation Algorithm  Dynamic programming: iterative (number of free variables decreases)  Solutions to algorithmic problems 1.Unnecessary recalculations in case of shared path suffixes  Store only the best of those path prefixes that end at the same adornment 2.Exponential number of adornments (2 5 )  Store only a limited number of adornments in each column  Limit: user-defined parameter of the algorithm (e.g., k=2 in our example) 3. Adornments without outgoing edges  Reachability analysis (not discussed now) BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFBBBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) 43210

35 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 35 Motivation  Model-driven technology in an industrial context?  Requirement from supporting tools  Efficiency  Scalability  Standard compliance  Important scenarios from the model-driven domain  Application condition checks in rule-based model transformation tools  Bidirectional model synchronization  On-the-fly consistency validation  Problem in several scenarios: (general) pattern matching

36 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 36 Algorithm Initialization  Table is filled out  Columns: number of free variables in the initial adornment (+1)  Rows: user-defined parameter (k=2)  Table initialization  Initial state to the top-left field BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB **BF* ***BF **FB* BBF** BBB** ***FB ***BB **BB* B***B 1/ BFFFF

37 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 37 Algorithm observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB **BF* ***BF **FB* BBF** BBB** ***FB ***BB **BB* B***B 1/ observes(SE,SW) inPosition(SW,SWP) BB ***BB **BB* observes(SE,SW) FB**FB* 1 sensors(RO,IDX,SE) BBFBBF** 1 sensors(RO,IDX,SE) BBBBBB** BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF 10 The algorithm follows only the present extension operations

38 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 38 Algorithm BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 1 BFB***F 1 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* BFFFB 1 0 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB **BF* ***BF **FB* BBF** BBB** ***FB ***BB **BB* B***B 1/ inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) FB BB ***FB ***BB **BB* Operations are copied, filtered, and recategorized in an increasing weight order Future extension operations can be recategorized to present extension operations observes(SE,SW) FB**FB* 1 sensors(RO,IDX,SE) BBFBBF** 1 sensors(RO,IDX,SE) BBBBBB** Repeated checks for a constraint are disallowed in any following states Variable SWP can no longer be free

39 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 39 Model-Sensitive Operation Weights BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors [2] [1] RO IDX SWP * * * RO IDX SWP * * * SE sw1SW F B SE sw2SW F B RO IDX SWP * * * RO IDX SWP * * * se1SE sw1SW F B se2SE sw2SW F B Operation weight: average branching factor #Switch #observes 2 2 =1=w(observes(SE,SW) FB )= FB 1defines(RO,SWP) Numbers based on model statistics

40 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 40 Search Plan Costs BFFFF sensors(RO,IDX,SE) BFF BFFBBBFFFBBBBBB BF defines(RO,SWP)inPosition(SW,SWP) FB 112 RO IDX SWP B F F SE SW F F RO IDX SWP B F B SE SW F F RO IDX SWP B F B SE SW F B RO IDX SWP B B B SE SW B B RO IDX SWP B B B SE SW B B o1o1 o2o2 o3o3 Guesses for the number of partial matches traversed 11*11*1*2

41 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 41 Search Plan Costs BFFFF sensors(RO,IDX,SE) BFF BFFBBBFFFBBBBBB BF defines(RO,SWP)inPosition(SW,SWP) FB 112 RO IDX SWP B F F SE SW F F RO IDX SWP B F B SE SW F F RO IDX SWP B F B SE SW F B RO IDX SWP B B B SE SW B B RO IDX SWP B B B SE SW B B c(o 1 ) = 1 o1o1 o2o2 o3o3 c(o 1,o 2 ) = 1 + 1*1 c(o 1,o 2,o 3 ) = 1 + 1*1 + 1*1*2 11*11*1*2 c(o 1,…,o n ) = w(o 1 ) + … + w(o 1 ) *···* w(o n-1 ) + w(o 1 ) *···*w (o n-1 ) *w (o n ) c(o 1,…,o n-1 ) π (o 1,…,o n ) π (o 1,…,o n-1 ) w (o n ) * +c(o 1,…,o n ) = = Product function: guessed number of partial matches on the n th level Search plan cost function: Guessed number of all partial matches Both functions can be calculated iteratively

42 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 42 Algorithm Data Structures: Adornments and Search Plan Cost BFFFF 10 c(o 1,…,o n-1 ) π (o 1,…,o n ) π (o 1,…,o n-1 ) w (o n ) * +c(o 1,…,o n ) = = BFFFF BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ FB 1defines(RO,SWP)

43 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 43 Algorithm Data Structures: Operation Mask BFFFF 10 BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ FB 1defines(RO,SWP) Mask: operation adornment (binding precondition) projected onto a fixed sequence of all variables (RO,IDX,SE,SW,SWP) B***F BFF** **BF* ***BF BBF** BBB** ***FB ***BB **BB* B***B F***B **FB* RO: don’t care IDX: don’t care SE: must be free (unbound) SW: must be bound SWP: don’t care

44 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 44 Algorithm Data Structures: Present and Future Operations BFFFF 10 BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ FB 1defines(RO,SWP) B***F BFF** **BF* ***BF BBF** BBB** ***FB ***BB **BB* B***B F***B **FB* Variable RO is bound Operation requires variable RO to be free Variable SWP is free Operation requires variable SWP to be bound Requirement might be fulfilled at a later stage Future operation All requirements are fulfilled now Present (immediately applicable) operation Requirement can never be fulfilled Past (non-applicable) operation

45 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 45 Algorithm Data Structures: Extension and Check Operations BFFFF 10 BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ B***F BFF** **BF* ***BF BBF** BBB** ***FB ***BB **BB* B***B **FB* Requirement might be fulfilled at a later stage Future operation All requirements are fulfilled now Present (immediately applicable) operation All variables are required to be bound Check operation At least one variable must be free Operation binds a variable and match is extended Extension operation

46 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 46 Algorithm Data Structures: Operation Category Combinations BFFFF 10 BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ B***F BFF** **BF* ***BF BBF** BBB** ***FB ***BB **BB* B***B **FB* PresentExtension FutureExtension FutureCheck

47 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 47 Algorithm Data Structures: Operation Sorting BFFFF 10 BF 1 sensors(RO,IDX,SE) defines(RO,SWP) BFF 2 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB 1/ B***F BFF** **BF* ***BF BBF** BBB** ***FB ***BB **BB* B***B **FB* Operations are stored sorted in their corresponding category

48 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 48 Algorithm: Initial State BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB FB BB **BF* ***BF **FB* BBF** BBB** ***FB ***BB **BB* B***B 1/

49 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 49 BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFB Available Search Plans BBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP)

50 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 50 BFFFF observes(SE,SW) sensors(RO,IDX,SE) BFF FB BBBFF BFFBBBFFFB Model-Sensitive Operation Weights BBBBB BBBBF inPosition(SW,SWP) BF defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) BF FB BBBFB BFBBB sensors(RO,IDX,SE) BFF BF defines(RO,SWP)inPosition(SW,SWP) FB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors [2] [1] RO IDX SWP * * * RO IDX SWP * * * SE sw1SW F B SE sw2SW F B RO IDX SWP * * * RO IDX SWP * * * se1SE sw1SW F B se2SE sw2SW F B Operation weight: average branching factor #Switch #observes 2 2 =1= 1 w(observes(SE,SW) FB )=

51 Search plan: a sequence of operations 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 51 BFFFFBBBFF Search Plan Driven Pattern Matching I. BBBBBBBBBF inPosition(SW,SWP) BF observes(SE,SW) BF ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer roRO IDX SE SWP B F F F F roRO 1IDX se1SE SWP B B B F F roRO 1IDX se1SE sw1SE SWP B B B B F roRO 1IDX se1SE sw1SE spSWP B B B B B roRO 2IDX se2SE sw2SE SWP B B B B F roRO 2IDX se2SE SWP B B B F F defines(RO,SWP) BB B F F F F [2] [1] Adornment: binding information for all variablesOperation Operation adornment: binding precondition RO, IDX, SE must be bound, free, free, respectively Free variables IDX and SE get bound by the operation sensors(RO,IDX,SE) BFF

52 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 52 BFFFF defines(RO,SWP) Search Plan Driven Pattern Matching II. BBBBF inPosition(SW,SWP) BF BBBFB sensors(RO,IDX,SE) BFF observes(SE,SW) BF defines(RO,SWP) ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer roRO IDX SE SWP observes(SE,SW) BF B F F F F roRO 1IDX se1SE SWP B B B F F roRO 1IDX se1SE spSWP B B B F B roRO 1IDX se1SE sw1SE spSWP B B B B B roRO 2IDX se2SE spSWP B B B F B roRO 2IDX se2SE sw2SE spSWP B B B B B roRO 2IDX se2SE SWP B B B F F BBBFFBBBBB [2] [1]

53 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 53 Algorithm template BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFF 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 1 BFFFB 10 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1

54 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 54 Algorithm template 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BBBFF 2 observes(SE,SW) BF**BF* 1 2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 2 BFFBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 3 BBBFB 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBFB 2 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBF 2 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 BFB***F 1defines(RO,SWP) 3 BFBBB 1 observes(SE,SW) FB**FB* 1 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BBBBB 2 observes(SE,SW) BB**BB* inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 5 BBBBB 2 inPosition(SW,SWP) FB***FB 1 BFB***F 1 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 5 BBBBB 2 observes(SE,SW) BF**BF* 1 sensors(RO,IDX,SE) BFFBFF** 2 5 BBBBF 1 observes(SE,SW) BF**BF* 1 inPosition(SW,SWP) BF***BF 1/2 sensors(RO,IDX,SE) BFFBFF** 2 6 BBBBF 2 observes(SE,SW) BF**BF* 1 BFB***F 1defines(RO,SWP)

55 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 55 TODO – 05 Pattern Matching Techniques 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) 3 FB BF BFF BBBFB ***FB B***F BFF** 1/ BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) observes(SE,SW) BF**BF* 1/2 BBB***B sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF BFF** **BF* ***BF 2 1/2 1 4 BBBBB 1

56 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 56 TODO – 05 Pattern Matching Techniques

57 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 57 TODO – 05 Pattern Matching Techniques 1 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF FB BBF BBB BF BB BFF** **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 2 1/3 1/ BFFFF 1 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) 4 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF FB BF BB BFF** **BF* ***FB ***BF ***BB **BB* B***B 2 1/3 1/2 1 3 FB BF BFF FB BBB BBF BB BFFBB ***FB B***F BFF** ***FB BBB** BBF** **BB* 1/ BBBFF 2 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF FB BBF BBB BB BFF** **BF* ***FB **FB* BBF** BBB** ***BB **BB* 2 1/3 1/ BFFFB 30

58 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 58 TODO – 05 Pattern Matching Techniques 2 BBB***B sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) 8 defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* ***BF 2 1/2 1 3 FB BF BFF BB BBBFB ***FB B***F BFF** **BB* 1/ BBBBB 13 BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) inPosition(SW,SWP) defines(RO,SWP) BB ***BB B***B inPosition(SW,SWP) BB***BB observes(SE,SW) BF**BF* 1/2

59 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 59 TODO – 05 Pattern Matching Techniques 3 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF FB BB BFF** **BF* ***FB ***BB **BB* 2 1/3 1/2 BBBFB 69 BFB***F 3 inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) FB **FB* ***FB 1/3 1 BFBBB 15 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BB FB BFF** **BB* ***FB 2 1/3 BBBBB 26 BFB***F 3defines(RO,SWP) BBBBB 36 BFB***F 3 inPosition(SW,SWP) defines(RO,SWP) FB***FB 1/3 BBBBB 210 BFB***F 3defines(RO,SWP) BBBBB 311 sensors(RO,IDX,SE) BFFBFF** 2 sensors(RO,IDX,SE) BFFBFF** 2 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 observes(SE,SW) BF**BF* 1/2

60 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 60 TODO – 05 Pattern Matching Techniques 1 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF 2 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) defines(RO,SWP) BFF FB BFF** ***FB 2 1/3 3 BFFFB 30

61 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 61 TODO – 05 Pattern Matching Techniques 2 BBB***B sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) 8 defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* ***BF 2 1/2 1 3 FB BF BFF BBBFB ***FB B***F BFF** 1/ BBBBB 13 BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) observes(SE,SW) BF**BF* 1/

62 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 62 TODO – 05 Pattern Matching Techniques 3 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BF FB BFF** **BF* ***FB 2 1/3 1/2 BBBFB 69 BFB***F 3 inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) FB **FB* ***FB 1/3 1 BFBBB 15 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BB FB BFF** **BB* ***FB 2 1/3 BBBBB 26 BFB***F 3defines(RO,SWP) BBBBB 36 BFB***F 3 inPosition(SW,SWP) defines(RO,SWP) FB***FB 1/3 BBBBB 210 BFB***F 3defines(RO,SWP) BBBBB 311 sensors(RO,IDX,SE) BFFBFF** 2 sensors(RO,IDX,SE) BFFBFF** 2 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 observes(SE,SW) BF**BF* 1/2

63 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 63 TODO – 05 Pattern Matching Techniques  Rehearsal: PM problem itself  PM state space  Operations, Search plans  Interpreter-based vs. compiled  How to find the optimum?  Operation weights (static, static from typical models, dynamic)  Cost functions (sum, product, sum-product)  Search plan generation algorithms (graph-based, dynamic programming based)  Search plan scheduling (compile time, runtime, on-demand)  Incremental Pattern Matching

64 13. Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 64 Pattern Matching ro:Route d:defines sp:SwPossw1:Switch o1:observes Model se1:Sensor s1:sensors sw2:Switch o2:observes se2:Sensor i:inPosition s2:sensors RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Pattern IDX:Integer [2] [1] RO:Route defines SWP:SwPosSW:Switch observes SE:Sensor sensors inPosition Metamodel {ordered} sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP)

65 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 65 Algorithm Data Structures BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB BF BB **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 1/3 1/

66 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 66 Algorithm 1 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB BF BB **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 1/3 1/ sensors(RO,IDX,SE) BFFBFF** 2 2 BBBFF 2

67 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 67 Algorithm 1 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 2 BBBFF 2 0 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB BF BB **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 1/3 1/ inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) FB BF BB ***FB ***BF ***BB **BB* B***B 1/ Operations are copied, filtered, and recategorized in an increasing weight order Future extension operations can be recategorized to present extension operations Repeated checks for a constraint are disallowed in any following states Variable SE can no longer be free

68 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 68 Algorithm 1 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 10 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB BF BB **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 1/3 1/ BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 2 BBBFF 2 inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) FB BF BB ***FB ***BF ***BB **BB* B***B 1/3 1 State is inserted into an empty field

69 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 69 Algorithm 1 4 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 2 BBBFF 2 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 BFFFF 10 inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BF FB BBF BBB BF BB **BF* ***FB **FB* BBF** BBB** ***BF ***BB **BB* B***B 1/3 1/ inPosition(SW,SWP) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) FB BF BB ***FB ***BF ***BB **BB* B***B 1/

70 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 70 Algorithm 1 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 2 BBBFF 2 sensors(RO,IDX,SE) inPosition(SW,SWP) BFF FB BFF** ***FB 2 1/3 BFB***F 3defines(RO,SWP) 3 BFFFB

71 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 71 Algorithm 1 2 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 2 BBBFF 2 3 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) defines(RO,SWP) BFF FB BFF** ***FB 2 1/3 3 BFFFB 3 BFB***F 3 sensors(RO,IDX,SE) defines(RO,SWP) BFFBFF** 2 4 BFFFF

72 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 72 Algorithm 1 3 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF 2 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) defines(RO,SWP) BFF FB BFF** ***FB 2 1/3 3 BFFFB

73 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 73 Algorithm 1 2 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF 2 3 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) defines(RO,SWP) BFF FB BFF** ***FB 2 1/3 3 BFFFB BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BF FB BFF** **BF* ***FB 2 1/3 1/2 BBBFB 69 01

74 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 74 Algorithm 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF 2 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BF FB BFF** **BF* ***FB 2 1/3 1/2 BBBFB 69 3 BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP)

75 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 75 Algorithm 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BF FB BFF** **BF* ***FB 2 1/3 1/2 BBBFB 69 3 BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) 8 inPosition(SW,SWP) sensors(RO,IDX,SE) 3 FB BF BFF BBBFB ***FB B***F BFF** 1/3 2 6 observes(SE,SW) BF**BF* 1/2 0

76 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 76 Algorithm 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) 3 FB BF BFF BBBFB ***FB B***F BFF** 1/ BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) observes(SE,SW) BF**BF* 1/2 BFB***F 3 inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) FB **FB* ***FB 1/3 1 BFBBB 15 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BB FB BFF** **BB* ***FB 2 1/3 BBBBB 26

77 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 77 Algorithm 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) 3 FB BF BFF BBBFB ***FB B***F BFF** 1/ BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) observes(SE,SW) BF**BF* 1/2 BFB***F 3 sensors(RO,IDX,SE) inPosition(SW,SWP) observes(SE,SW) defines(RO,SWP) BFF BB FB BFF** **BB* ***FB 2 1/3 BBBBB 26 BBB***B sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF BFF** **BF* ***BF 2 1/2 1 4 BBBBB 1

78 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 78 Algorithm 1 1 BFB***F 3 sensors(RO,IDX,SE) observes(SE,SW) 4 defines(RO,SWP) inPosition(SW,SWP) observes(SE,SW) sensors(RO,IDX,SE) defines(RO,SWP) BFF BF BFF** **BF* 2 1/2 3 FB BF BFF FB BFFBB ***FB B***F BFF** ***FB 1/ BBBFF defines(RO,SWP) inPosition(SW,SWP) sensors(RO,IDX,SE) 3 FB BF BFF BBBFB ***FB B***F BFF** 1/ BBBBF 1 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 inPosition(SW,SWP) BF***BF 1 BFB***F 3defines(RO,SWP) observes(SE,SW) BF**BF* 1/2 BBB***B sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF BFF** **BF* ***BF 2 1/2 1 4 BBBBB 1 BFB***F 3defines(RO,SWP) BBBBB 36 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2 BFB***F 3 inPosition(SW,SWP) defines(RO,SWP) FB***FB 1/3 BBBBB 210 sensors(RO,IDX,SE) BFFBFF** 2 BFB***F 3defines(RO,SWP) BBBBB 311 sensors(RO,IDX,SE) BFFBFF** 2 observes(SE,SW) BF**BF* 1/2

79 Juli 2014 | Real-Time Systems Lab | Prof. Dr. Andy Schürr | Dr. Gergely Varró | 79 Algorithm BB sensors(RO,IDX,SE) observes(SE,SW) inPosition(SW,SWP) defines(RO,SWP) BFF BF B***B BFF** **BF* ***BF 2 1/2 1 4 BBBBB 1


Download ppt "Gergely Varró, Frederik Deckwerth, Martin Wieber, Andy Schürr 13. Juli."

Similar presentations


Ads by Google