Heuristicbased Recommendation for MetamodelOCL Coevolution Edouard Batot Wael
Heuristic-based Recommendation for Metamodel–OCL Coevolution Edouard Batot, Wael Kessentini, Houari Sahraoui, Michalis Famelis DIRO, Université de Montréal
OCL basics: Family tree example Type graph Person father 02/03/2021 mother Metamodel = Type graph + constraints To exclude the bad ones, we need this OCL constraints: Context Person: inv inheritance_bares_no_loop_mum: self. mother->closure()->excludes(self) inv inheritance_bares_no_loop_dad: self. father->closure()->excludes(self) A person cannot be its own mother or father … transitively. 2
Schematically: Type graph Instance model Instance model OCL Instance model 02/03/2021 Metamodel Instance model 3
What happens if the type model changes ? OCL Coevolution father Person Name change in type graph impacts OCL constraints Context Person: inv inheritance_bares_no_loop_mum: mum self. mother->closure()->excludes(self) inv inheritance_bares_no_loop_dad: self. father->closure()->excludes(self) 02/03/2021 mum mother • More complicated example of evolution self. name. Category self. category. name. Category Employee name: Estring age: EInt salary: Edouble name. Category: EString Indirection inserted * 1 category Category name. Category: EString 4
Problem: OCL Coevolution Type graph version 1. 0 Instance model Instance model Instance model / Instance model OCL 02/03/2021 Type graph version 2. 0 Instance model ? Instance model OCL ? Instance model Usually: • Force determinism, or • Trace rationale behind high-level changes 5
Our Approach 02/03/2021 Heuristic search Recommendation 6 1 2 3 4
• Does not depend on tracing of high level changes (tedious, error-prone) • Search a large solution space (chance for innovation) 02/03/2021 Additional Benefits • Extensible framework for new coevolution strategies (as new mutation ops) 7
Outline 02/03/2021 Heuristic search Recommendation 8 1 2 3 4
Heuristic Search: Genetic programming Genetic operators Non-dominance Sorting G 0 Front 1 Pareto front Front 2 Output Front 3 Front 4 Q 0 Crowding distance Sorting within the fronts Front 3 02/03/2021 Repeat until end condition is reached G 1 Rejected Front 5 Non-sorting Genetic Algorithm – II (NSGA-II) 9
• Representation: a solution is a set of OCL constraints 02/03/2021 Heuristic Search: Genetic programming • Each constraint: Ecore Abstract Syntax Tree • In each generation, OCL evolved by crossovers and mutations • End condition: Stabilization, at 300 iterations 10
1. Minimize change • # of mutations/crossover applied from original 02/03/2021 Heuristic Objectives 2. Minimize syntax error • # of rules fired (Not strict zero to loosen the search) 3. Minimize information loss • # of metamodel elements removed during OCL evolution 11
• Solution representation and creation • Initial generation = original set of OCL constraints • Point-cut crossover Point-cut C Parent 1 1 -1 C 1 -2 C 1 -3 C 1 -4 C 1 -5 C 2 -1 C 2 -2 C 2 -3 C 2 -4 C 2 -5 Parent 2 Crossover Child 1 C 1 -2 C 2 -3 C 2 -4 C 2 -5 Child 2 C 2 -1 C 2 -2 C 1 -3 C 1 -4 C 1 -5 02/03/2021 Genetic operators • Mutation patterns • Renaming • Indirection insertion • Context change • Change typing methode • Pruning Set of constraint Parent C X-X C 1 -1 C 1 -2 : Constraint C 1 -3 Mutated set of constraint Mutation C 1 -4 C 1 -5 Child C 1 -1 C 1 -2 C 1 -3 CM 1 -4 C 1 -4 mutant C 1 -5 12
Output Set: Solutions • Output: Pareto front of solutions • No total ordering • All solutions in the front are “equally good” • No solution dominates 02/03/2021 • NSGA-II: Multi-objective non-dominant search • Output can be too large to present to user • Instead: generate recommendations 13
Outline 02/03/2021 Heuristic search Recommendation 14 1 2 3 4
Recommending solutions Two strategies: • Ranking solutions using fitness objectives • Clustering solutions with syntactic comparison Levenstein distance Pareto front Clusters 02/03/2021 • NSGA-II gives many solutions (Pareto front) Which one is of user’s interest? Centroid Abstract centre of a cluster Recommendations Solutions representative of their cluster (closest to the centroid) 15
Outline 02/03/2021 Heuristic search Recommendation 16 1 2 3 4
• RQ 0: Are the results of our approach attributable to the search strategy or to the number of explored solutions? • RQ 1: To which extent our approach finds the expected solution? • RQ 2: To which extent our approach recommends the expected solution? 02/03/2021 Evaluation • Setup • 3 metamodels of different sizes (Family, State Machine, Project Management) • 30 executions for each metamodel/OCL couple • 300 iterations with a population of 100 set of constraints 17
02/03/2021 RQ 0: Sanity check • Better than random search • Same number of solutions explored, way better results 18
RQ 1: Algorithm recall State Machine Project Management 30 30 20 20 20 10 10 10 0 # of executions 30 1/4 2/4 3/4 4/4 # of constraints fixed 1/5 2/5 3/5 4/5 5/5 # of constraints fixed 1/6 ? ! 2/6 3/6 4/6 5/6 # of constraints fixed 02/03/2021 Family 6/6 # of expected solutions found • Family and State Machine cases: solutions found • Project Management case contains two missing constraints that require particularly complex changes • To address such changes we aim at expanding the mutation operator store 19
RQ 2: Recommendation system precision 5 # of constraints fixed 4 1 0 Project Management 6 5 4 3 2 State Machine 4 3 Clusters 2 Ranking 1 Pareto 3 5 7 9 11 13 15 17 19 # of recommendations 0 Clusters Ranking Pareto 3 5 7 9 11 13 15 17 19 # of recommendations 3 2 Clusters Ranking Pareto 1 0 02/03/2021 Family 3 5 7 9 11 13 15 17 19 # of recommendations # of expected solutions recommended • Accuracy of the recommender grows with the number of recommendations • No dramatic increase beyond 7 • Simple ranking is a better recommendation strategy Clustering is computationally costlier 20
Conclusion • Metamodel-OCL Coevolution is crucial to DSML design and maintenance 02/03/2021 Heuristic search • Our approach 1. Multi-objective optimization problem 2. Recommendation of a subset of generated solutions • Benefits • • • Does not depend on tracing high-level changes Does not assume single solution Explores a large solution space Extensible with new coevolution strategies High recall; Efficient ranking-based recommendation 1 2 3 4 Problem definition Approach Evaluation Conclusion Recommendation 21
Heuristic-based Recommendation for Metamodel–OCL Coevolution Edouard Batot, Wael Kessentini, Houari Sahraoui, Michalis Famelis 22
- Slides: 22