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 mother father 21/11/2017 Person 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: A person cannot be its self.father->closure()->excludes(self) own mother or father 2 … transitively.
Schematically: Type graph Instance model Metamodel 21/11/2017 Instance model Instance model Instance model Instance model OCL Instance model Instance Instance model model 3
What happens if the OCL Co evolution type model changes ? mother mum father Person Name change in type graph impacts OCL constraints 21/11/2017 Context Person: inv inheritance_bares_no_loop_mum: self.mother->closure()->excludes(self) mum inv inheritance_bares_no_loop_dad: self.father->closure()->excludes(self) • More complicated example of evolution self.category.nameCategory self.nameCategory Employee Employee name:Estring name:Estring age:EInt age:EInt salary:Edouble salary:Edouble nameCategory :EString 4 * Indirection inserted 1 category Category nameCategory :EString
Problem: OCL Coevolution Type graph version 1.0 Type graph version 2.0 Instance Instance 21/11/2017 model model Instance Instance Instance Instance model model model model Instance Instance model model Instance Instance model model / ? Instance model Instance Instance model Instance model model Instance OCL ? Instance model model OCL Usually: 5 • Force determinism, or • Trace rationale behind high-level changes
Our Approach Heuristic 21/11/2017 search Recommendation 6 1 2 3 4
Additional Benefits • Does not depend on tracing of high level changes (tedious, error-prone) 21/11/2017 • Search a large solution space (chance for innovation) • Extensible framework for new coevolution strategies (as new mutation ops) 7
Outline Heuristic 21/11/2017 search Recommendation 8 1 2 3 4
Heuristic Search: Genetic programming Repeat until end condition is reached Non-dominance Crowding distance 21/11/2017 Sorting within the fronts Sorting Pareto Front 1 front G e n e t i c o p e r a t o r s Output Front 2 Front 3 G0 G1 Front 3 Front 4 Rejected Front 5 Q0 9 Non-sorting Genetic Algorithm – II (NSGA-II)
Heuristic Search: Genetic programming 21/11/2017 • Representation: a solution is a set of OCL constraints • Each constraint: Ecore Abstract Syntax Tree • In each generation, OCL evolved by crossovers and mutations • End condition: Stabilization, at 300 iterations 10
Heuristic Objectives 1. Minimize change 21/11/2017 • # of mutations/crossover applied from original 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
Genetic operators • Solution representation and creation • Initial generation = original set of OCL constraints 21/11/2017 • Point-cut crossover Point-cut C C C C C Crossover C C C C C Parent 1 Child 1 1-1 1-2 1-3 1-4 1-5 1-1 1-2 2-3 2-4 2-5 C C C C C C C C C C Parent 2 Child 2 2-1 2-2 2-3 2-4 2-5 2-1 2-2 1-3 1-4 1-5 • Mutation patterns • Renaming • Indirection insertion • Context change • Change typing methode • Pruning Set of constraint Mutated set of constraint Mutation C C C CM C C C C C C Parent Child 12 1-1 1-2 1-3 1-4 1-5 1-1 1-2 1-3 1-4 1-5 C1-4 C : Constraint mutant X-X
Output Set: Solutions • NSGA-II: Multi-objective non-dominant search 21/11/2017 • Output: Pareto front of solutions • No total ordering • All solutions in the front are “equally good” • No solution dominates • Output can be too large to present to user • Instead: generate recommendations 13
Outline Heuristic 21/11/2017 search Recommendation 14 1 2 3 4
Recommending solutions • NSGA-II gives many solutions (Pareto front) Which one is of user’s interest? 21/11/2017 Two strategies: • Ranking solutions using fitness objectives • Clustering solutions with syntactic comparison Levenstein distance Centroid Pareto front Abstract centre of a cluster Recommendations Clusters Solutions representative of their cluster 15 (closest to the centroid)
Outline Heuristic 21/11/2017 search Recommendation 16 1 2 3 4
Evaluation • RQ0 : Are the results of our approach attributable to the search strategy or to the number of explored solutions? 21/11/2017 • RQ1 : To which extent our approach finds the expected solution? • RQ2 : To which extent our approach recommends the expected solution? • 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
RQ0: Sanity check 21/11/2017 • Better than random search • Same number of solutions explored, way better results 18
RQ1: Algorithm recall Family State Machine Project Management 30 30 30 # of executions 20 20 20 21/11/2017 10 10 10 0 0 0 1/4 2/4 3/4 4/4 1/5 2/5 3/5 4/5 5/5 1/6 2/6 3/6 4/6 5/6 6/6 # of constraints fixed # of constraints fixed # of constraints fixed # 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 19 operator store
RQ2: Recommendation system precision Family State Machine Project Management 4 5 6 5 # of constraints fixed 4 3 4 21/11/2017 3 2 3 Clusters 2 Clusters 2 Clusters 1 Ranking Ranking 1 Ranking 1 Pareto Pareto Pareto 0 0 0 3 5 7 9 11 13 15 17 19 3 5 7 9 11 13 15 17 19 3 5 7 9 11 13 15 17 19 # of recommendations # of recommendations # of recommendations # of expected solutions recommended • Accuracy of the recommender grows with the number of recommendations • No dramatic increase beyond 7 20 • Simple ranking is a better recommendation strategy Clustering is computationally costlier
Conclusion • Metamodel-OCL Coevolution is crucial to DSML design and maintenance Heuristic search 21/11/2017 • Our approach 1. Multi-objective optimization problem 2. Recommendation of a subset of generated solutions Recommendation • Benefits Problem definition • Does not depend on tracing high-level changes 1 2 3 4 Conclusion Evaluation Approach • Does not assume single solution • Explores a large solution space • Extensible with new coevolution strategies • High recall; Efficient ranking-based recommendation 21
Recommend
More recommend