660 likes | 668 Views
This project focuses on using model merging to reconcile complementary views of different stakeholders and unite changes made in distinct branches of an SCM system, as well as combine distinct program variants into a single-copy product line representation.
E N D
N-Way Model MergingCSC2125 Project Julia Rubin December 19, 2012
Model merging is used to: • Reconcile complimentary views of different stakeholders
Model merging is used to: • Reconcile complimentary views of different stakeholders • Unite changes made in distinct branches of an SCM system
Model merging is used to: • Reconcile complimentary views of different stakeholders • Unite changes made in distinct branches of an SCM system • Combine distinct program variants into a single-copy product line representation
Consists ofthree steps: • Compare – a heuristic that calculates the similarity degree for input elements y z x M1 M2 Compare ? ?
Consists ofthree steps: • Compare – a heuristic that calculates the similarity degree for input elements • Match – a heuristic that decides which elements are similar, based on the results of compare y z x M1 M2 Match
Consists ofthree steps: • Compare – a heuristic that calculates the similarity degree for input elements • Match – a heuristic that decides which elements are similar, based on the results of compare • Merge – an algorithm that combines matched elements in a prescribed way Union-merge, agreement-based, annotative, … Merge M1+M2 xy z
Merging is extensively studied • UML class diagram • UML state machines • Matlab/Simulink models • Verilog • … Existing works focus on two input models!
Do it in a pair-wise manner, one by one! What if we want to composen inputs?
Example Circle Square Square Square 0.66 M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
Example Circle Square Square Square 0.66 M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point Elements of a pair share one attribute and have one proprietary attribute each M3
Example Circle Square Square Square 0.66 M2 M1 position:point width:int position:point radius:int center:point width:int position:point center:point 0.66 0.66 0.66 0.66 M3
Example Circle Square Square Square 0.66 M2 M1 position:point width:int position:point radius:int center:point width:int position:point center:point Pair-wise similar(no matter how we define compare) 0.66 0.66 0.66 0.66 M3
Example Circle Square Square Square 0.66 M2 M1 position:point width:int center:point width:int position:point radius:int position:point center:point 0.66 0.66 0.66 0.66 M3
Example: the first merge Square/Circle Square Square [M3] M1+M3 M2 position:point [M1, M3] center:point [M1] radius:int [M3] position:point width:int center:point width:int
Example: the first merge Square/Circle Square Square [M3] M1+M3 M2 position:point [M1, M3] center:point [M1] radius:int [M3] position:point width:int center:point width:int 0.62 0.66
Example: the first merge Square/Circle Square Square [M3] M1+M3 M2 position:point [M1, M3] center:point [M1] radius:int [M3] position:point width:int center:point width:int 0.62 0.66
Example: the second merge M1+ M2 +M3 Square/Circle Square position:point [M1, M3] center:point [M1] radius:int [M3] position:point [M2] center:point [M3] width:int [M2,M3]
Example: the second merge M1+ M2 +M3 M1 M2 M3 Square/Circle Square Square Circle Square Square position:point [M1, M3] center:point [M1] radius:int [M3] position:point width:int position:point [M2] center:point [M3] width:int [M2,M3] position:point radius:int center:point width:int position:point center:point
Example: the second merge M1+ M2 +M3 M1 M2 M3 Square/Circle Square Circle Square Square Square position:point [M1, M3] center:point [M1] radius:int [M3] center:point width:int position:point [M2] center:point [M3] width:int [M2,M3] position:point width:int position:point radius:int position:point center:point “Outlier”
Example: the second merge M1+ M2 +M3 Square/Circle Square Circle Square Square Square position:point [M1, M3] center:point [M1] radius:int [M3] position:point radius:int center:point width:int position:point width:int position:point [M2] center:point [M3] width:int [M2,M3] position:point center:point M1 M2 M3
Example: the second merge M1+ M2 +M3 Square/Circle Circle [M3] Square Circle Square Square Square position:point [M1, M3] center:point [M1] radius:int [M3] position:point [M2] center:point [M3] width:int [M2,M3] position:point radius:int position:point radius:int center:point width:int position:point width:int position:point center:point Square position:point [M1,M2] center:point [M1,M3] width:int [M2,M3] M1 M2 M3
Example: the second merge M1+ M2 +M3 Square/Circle Circle [M3] Square position:point [M1, M3] center:point [M1] radius:int [M3] position:point [M2] center:point [M3] width:int [M2,M3] position:point radius:int Square position:point [M1,M2] center:point [M1,M3] width:int [M2,M3] Taking the global view is better
Maybe some “smart” heuristic on the order of merging models? Circle Square Square Square position:point radius:int center:point width:int position:point width:int position:point center:point M1 M2 M3
Maybe some “smart” heuristic on the order of merging models? Circle Square Square Square position:point radius:int center:point width:int position:point width:int position:point center:point Selecting M1 and M1 first would eliminate the problem M1 M2 M3
Maybe some “smart” heuristic on the order of merging models? Circle Square Square Square position:point radius:int center:point width:int position:point width:int position:point center:point Selecting M1 and M1 first would eliminate the problem Does not work in the general case M1 M2 M3
Earlier Example – an Abstract Form M1 M2 AB A C Circle Square Square Square position:point radius:int center:point width:int position:point width:int position:point center:point B C A D M3
Earlier Example M1 M2 AB A C M3 B C A D
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M Models are pair-wise similar E H E F F G Without seeing the “global picture”, it is impossible to know which match is the best B C A D I K E G M3
Example 2 A C M2 M1 A B J K I J I M E H E F F G B C A D I K E G M3
Do it in a pair-wise manner, one by one! What if we want to composen inputs? Look at n models simultaneously –n-way merge!
Outline • Why model merging? • Why n-way merge? • Formal definition of n-way merge (using Alloy) • Data representation • The compare operator • The match operator • The merge operator • Issues with the implementation • Next steps
1. Data Representation • In general: • a model is a typed graph • In this work: • all elements are of the same type • e.g., UML classes • relevant information about elements is represented by properties A-Z • e.g., UML class attributes and methods
2. The Compare Operator Each element of the tuple comes from some InputModel
2. The Compare Operator There are no two elements from the same model
2. The Compare Operator union is a set of all properties of all tuple elements
2. The Compare Operator Weight is Alloy does not support floating point numbers. Thus, we limit the precision to one decimal digit and do not normalize by the number of models
Example Circle Square Square Square M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
Example /3=2 (2+2+2) positioncenterwidth Circle Square Square Square M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
Example /3=1.33 (2+2) positioncenterwidth Circle Square Square Square M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
Example /3=1.33 (2+2) positioncenterradius Circle Square Square Square M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
Example (2+2+2) /4=1.5 positioncenterwidthradius Circle Square Square Square M2 M1 position:point radius:int center:point width:int position:point width:int position:point center:point M3
3. The Match Operator Disjoint: no element appears in two tuples