Automatic Effective Model Discovery

85
Automatic Effective Model Discovery Sagar Sen Thesis Director: Jean-Marc Jézéquel Thesis Supervisor: Benoit Baudry Co-supervisor : Hans Vangheluwe 1 DOMINO

description

Automatic Effective Model Discovery. Sagar Sen Thesis Director: Jean-Marc Jézéquel Thesis Supervisor: Benoit Baudry Co-supervisor : Hans Vangheluwe. DOMINO. There are many mansions in the mind of a scientist. Nikola Tesla (Inventor). Experiments. Laws of Science. Instruments. design. - PowerPoint PPT Presentation

Transcript of Automatic Effective Model Discovery

Page 1: Automatic Effective Model Discovery

1

Automatic Effective Model Discovery

Sagar Sen

Thesis Director: Jean-Marc JézéquelThesis Supervisor: Benoit BaudryCo-supervisor : Hans Vangheluwe

DOMINO

Page 2: Automatic Effective Model Discovery

2

There are many mansions in the mind of a scientist

Nikola Tesla

(Inventor)

Page 3: Automatic Effective Model Discovery

3

Laws of Science

Experiments

Instruments

Model of the Electric Motor

design

Page 4: Automatic Effective Model Discovery

4

Models : Are simplified abstract views of complex reality

Effective Models: Models that serve a purpose or satisfy an objective. It is created based on knowledge from heterogeneous sources.

The notion of effectiveness

Page 5: Automatic Effective Model Discovery

5

DNA Molecule

Tesla Electric Motor

An effective model to predict and invent

An effective model discovered in nature

Page 6: Automatic Effective Model Discovery

6

Effective Models in Software

Effective Model of Phone Behavior used by millions

Page 7: Automatic Effective Model Discovery

7

An effective model is a product of mental tacit and manual work

Can we automate discovery of effective models?

In the context of Software Systems

Page 8: Automatic Effective Model Discovery

8

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 9: Automatic Effective Model Discovery

9

Model-driven Engineering (MDE) of Software Systems

Modelling Domain Specification (A “Blueprint” : Concepts with Properties allowed in a set of

models)

Modelling Domain

Phone Behavior Model

Models are first-class artifacts in MDE

Page 10: Automatic Effective Model Discovery

10

Set of all Finite State Machines

Example Modelling DomainMetamodel (a blueprint) of Finite State

Machines

Page 11: Automatic Effective Model Discovery

11

Automatic Effective Model DiscoveryThe Problem

Page 12: Automatic Effective Model Discovery

12

Modelling Domainspecification

Page 13: Automatic Effective Model Discovery

13

Source 1 Source 2 Source N…

Heterogeneous sources of knowledge may guide discovery

Page 14: Automatic Effective Model Discovery

14

Source 1 Source 2 Source N…

Effective Modelling Domain

Discovery Mechanism?

Effective Models

??Reliable Sources?

Page 15: Automatic Effective Model Discovery

15

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 16: Automatic Effective Model Discovery

16

Conceptual Solution

Source 1 Source 2 Source N

Modelling Domainspecification

Transform

Effective Modelling Domain specification

defines

Constraint Satisfaction Problem (CSP)

Page 17: Automatic Effective Model Discovery

17

Source 1 Source 2 Source N

Modelling Domain

specification

Constraint Satisfaction Problem

Solve

Effective Modelling Domain

Conceptual Solution

Page 18: Automatic Effective Model Discovery

18

Main Challenges1. Heterogeneous sources of knowledge are

expressed in different languages. How can we transform them to a single constraint satisfaction problem?

2. Knowledge is expressed on sets of objects in a model called meta-constraints. Eg. There must be at least one Final State in the set of all States in a Finite State Machine. How can we resolve such meta-constraints?

3. Models can be of infinite size! How do we control the generation of finite sized models?

Page 19: Automatic Effective Model Discovery

Technical Solution

19

Model Mx

UMLOCL

Modelling Domainspecification

Language Lxconforms to

CSP as Alloy Model

Transformation

Class Diagram Invariants

Page 20: Automatic Effective Model Discovery

Why Alloy ?

20

1. Sets of concepts/classes with properties can be modeled as Alloy signatures with fields in an Alloy model A.

2. Meta-constraints on the concepts in A can be modeled as Alloy facts and predicates (based on first-order relational logic with quantifiers)

3. Alloy model A can be solved in a finite scope to give solution instances.

CSP as Alloy Model

Page 21: Automatic Effective Model Discovery

21

Concrete Realization of Solution

Modelling Domain Specification

Metamodel Feature Diagram

Effective Model Discovery

in any Modelling Language

Effective Product Discovery

in the Variability Domain of a Software

Product

Page 22: Automatic Effective Model Discovery

22

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 23: Automatic Effective Model Discovery

23

Model Discovery in the domain of a Modelling Language

Metamodel MM

Set of Valid Models in a Modelling Language

How to discover effective models

for a given objective?

Page 24: Automatic Effective Model Discovery

24

Effective Model Discovery Objectivesin this Thesis

Objective 1: Test model discovery for detect bugs in model transformations

Objective 2: Partial Model Completion in Model Editors

Page 25: Automatic Effective Model Discovery

25

Motivating Example

UML2RDBMS(For Object Persistence)

Model Transformation

(MT)

Adding a friend on FB (Change in Social Graph)

Examples

Input Models Output Models

Input metamodel MM_in

Output metamodelMM_out

Page 26: Automatic Effective Model Discovery

26

Motivating Example

Model Transformation

(MT)

Input Models Output Models

There may be BUGS in the transformation MT!

Page 27: Automatic Effective Model Discovery

27

Motivating Example

Model Transformation

(MT)

Input Models Output Models

Can we discover the Effective Modelling Domain

and Effective TEST Models

that detect these bugs?

Page 28: Automatic Effective Model Discovery

28

What is the effective modelling domain for testing a

transformation?

Page 29: Automatic Effective Model Discovery

29

Input Models

MM_in

Heterogeneous Sources of Knowledge define the Effective Modelling Domain

Page 30: Automatic Effective Model Discovery

28

Input Models

MM_in

Heterogeneous Sources of Knowledge define the Effective Modelling Domain

Required Typesand Properties

Page 31: Automatic Effective Model Discovery

28

Input Models

MM_in

Invariants I on MM(OCL)

Heterogeneous Sources of Knowledge define the Effective Modelling Domain

Required Typesand Properties

Page 32: Automatic Effective Model Discovery

28

Input Models

MM_in

Invariants I on MM(OCL) Pre-condition

pre

Heterogeneous Sources of Knowledge define the Effective Modelling Domain

Pre MT

Input Domain

Required Typesand Properties

Page 33: Automatic Effective Model Discovery

28

Input Models

MM_in

Invariants I on MM(OCL) Pre-condition

pre

Test KnowledgeModelfragments F

Heterogeneous Sources of Knowledge define the Effective Modelling Domain

Pre MT

Test Models

Input Domain

Required Typesand Properties

Page 34: Automatic Effective Model Discovery

34

Automatic test model discovery : The Approach

Page 35: Automatic Effective Model Discovery

35

Running Example :UML2RDBMS Transformation

Pre UML2RDBMS Post

UML Class Diagram Models

RDBMS Models

Bezivin, J., Rumpe, B., Schurr, A., Tratt, L.: Model transformations in practice workshop, october 3rd 2005, part of models 2005. In: Proceedings of MoDELS. (2005)

Page 36: Automatic Effective Model Discovery

36

Input meta-model MM_in

Invariants I on MM_in(OCL)

Test Knowledgeas set of model fragments F

Test Model Discovery : The Approach

Pre MT

Pre-condition pre

Alloy Model

1.Metamodel Pruning

Effective metamodel eMM_in

2. MM2Alloy

4. MF2Alloy

3. OCL2Alloy(Manual/

Automatic)

Required Types and PropertiesT_req, P_req

Page 37: Automatic Effective Model Discovery

37

Metamodel Pruning : The Process

Input meta-model MM_in

Effective metamodel eMM_in

1.Metamodel Pruning

MT(UML2RDBMS)

Required Types and PropertiesClass

Association

Attribute

PrimitiveType

Package

NamedElement:name

static analysis

All UML Models

Class Diagrams

Page 38: Automatic Effective Model Discovery

38

Metamodel Pruning : The Results1. Required types and properties and their

obligatory dependencies are preserved.

2. All instances of effective MM are instances of input MM

3. Effective MM is a super type and a subset of of MM_in. This implies that all operations on eMM_in are valid for MM_insubsetOf

superTypeOf

UML Class Diagram Subset

Page 39: Automatic Effective Model Discovery

39

Input meta-model MM_in

Invariants I on MM_in(OCL)

Test Knowledgeas set of model fragments F

Test Model Discovery : The Approach

Pre MT

Pre-condition pre

Alloy Model

1.Metamodel Pruning

Effective metamodel eMM_in

2. MM2Alloy

4. MF2Alloy

3. OCL2Alloy(Manual/

Automatic)

Required Types and PropertiesT_req, P_req

Page 40: Automatic Effective Model Discovery

40

Why MM2Alloy ? Structural Similarity

Metamodel classes specify a “Set of Objects

with Properties”

Alloy signatures specify “sets of atoms”

and Alloy fields, facts, and predicate specify allowed “relations between atoms”

Object and Properties Atoms and Relations

meta-levelsimilarity

instance-levelsimilarity

Page 41: Automatic Effective Model Discovery

41

What aspects to transform by MM2Alloy?

Metamodel MM

Meta-metamodelling language

expressed in

Meta-metamodel (Eg. Ecore is an industrial standard)

specified by

Page 42: Automatic Effective Model Discovery

42

MM2Alloy : Bridging the Semantic Gap

Bird’s Eye view of the meta-metamodel Ecore that specifies the set of all metamodels

Page 43: Automatic Effective Model Discovery

43

MM2Alloy : Bridging the Semantic Gap

We zoom into the concept of Classes and Properties (Attributes and References)

(abstract-)Class and Properties to Alloy Signatures and Fields

Page 44: Automatic Effective Model Discovery

44

MM2Alloy : Bridging the Semantic Gap

We zoom into the concept of multiple inheritance

Flattening Multiple Inheritance to Single Inheritance in Alloy

Page 45: Automatic Effective Model Discovery

45

MM2Alloy : Bridging the Semantic Gap

Zoom into characteristics of properties

Opposite, Multiplicity of , Composite Properties to Alloy Facts

Page 46: Automatic Effective Model Discovery

46

Example Transformations to Alloy

Page 47: Automatic Effective Model Discovery

47

Transformation to Alloy (1)

Lets take the Classifier concept from the UML Class Diagram meta-model

Transformed to an Alloy Signatureabstract sig Classifier { name : String

}

Lets take the Class concept concept that inherits from Classifier

Transformed to an Alloy Signature

sig Class extends Classifier {

is_persistent: one Bool,

parent : lone Class,attrs : some

Attribute}

UML Class Diagram Subset

Page 48: Automatic Effective Model Discovery

48

Transformation to Alloy (2)Implicit Constraints to Facts

Containment is transformed to an Alloy factfact Association_containers{

(all o : Association |o in ClassModel.association)}

Page 49: Automatic Effective Model Discovery

49

MM2Alloy : Bridging the Semantic Gap

Example from Kermeta Type System MM to illustrate multiple containers

Multiple Containers to Alloy Facts

Containment is transformed to an Alloy factfact TypeVariableBinding_containers{

(all o1,o2,o3 : TypeVariableBinding| (o1 in ParameterizedType.typeParamBinding and o2 in ParameterizedType.virtualTypeBinding and o3 inVirtualType.typeParameterBinding ) anddisj[o1,o2,o3]}

Page 50: Automatic Effective Model Discovery

50

Input meta-model MM_in

Invariants I on MM_in(OCL)

Test Knowledgeas set of model fragments F

Test Model Discovery : The Approach

Pre MT

Pre-condition pre

Alloy Model

1.Metamodel Pruning

Effective metamodel eMM_in

2. MM2Alloy

4. MF2Alloy

3. OCL2Alloy(Manual/

Automatic)

Required Types and PropertiesT_req, P_req

Page 51: Automatic Effective Model Discovery

51

Transformation of OCL to Alloy

No Cyclic Inheritance

OCL Version:

context Class:

inv :

not self.allParents()->includes(self)

Alloy Version:

fact noCyclicInheritance {

no c: Class | c in c.^parent

}

manually to an Alloy fact ?

Page 52: Automatic Effective Model Discovery

52

Input meta-model MM_in

Invariants I on MM_in(OCL)

Test Knowledgeas set of model fragments F

Test Model Discovery : The Approach

Pre MT

Pre-condition pre

Alloy Model

1.Metamodel Pruning

Effective metamodel eMM_in

2. MM2Alloy

4. MF2Alloy

3. OCL2Alloy(Manual/

Automatic)

Required Types and PropertiesT_req, P_req

Page 53: Automatic Effective Model Discovery

53

Test Model Fragments1.We generate partitions of the effective

metamodel using “input domain partitioning” to cover various structural properties of the input domain.

“Franck Fleurey, Benoit Baudry, Pierre-Alain Muller, Yves Le Traon. Qualifying Input Test Data for Model Transformations. Software and Systems Modeling (SoSyM), Volume 8, Number 2, April 2009.”

2. We combine partitions using two strategies:

AllRanges and AllPartitions to give model fragments that cover wide range of characteristics the entire input metamodel

3. A model fragment is transformed to a predicate that must satisfied by a test model.

Page 54: Automatic Effective Model Discovery

54

Test Model Fragment to Alloy Predicate

pred modelFragment1{some a1:Class ,a2:Class, a3:Class|#a1.name=0 and a2.name=0and #a3.name>0}

automatically transformed to an Alloy predicate

a1 : Class

name : {null}

a2 : Class

name : {« »}

a3 :Class

name : {.+}

Page 55: Automatic Effective Model Discovery

55

Input meta-model MM_in

Invariants I on MM_in(OCL)

Test Knowledgeas set of model fragments F

Test Model Discovery : The Approach

Pre MT

Pre-condition pre

Alloy Model

1.Metamodel Pruning

Effective metamodel eMM_in

2. MM2Alloy

4. MF2Alloy

3. OCL2Alloy(Manual/

Automatic)

Required Types and PropertiesT_req, P_req

Page 56: Automatic Effective Model Discovery

56

Test Model Discovery: The Approach

Test Models

Alloy Model

5. Solve

Page 57: Automatic Effective Model Discovery

57

Can these test models detect bugs?1. Mutation Analysis: Detecting artificially injected bugs

2. We perform an empirical study to compare test models generated using different sources of knowledge. We use mutation score as a measure of comparison

Sources:

(a) AllPartition (5 fragments) of 8 sets of 50 models/set = 400 models(b) Random in Input Domain of 8 sets of 50 models/set = 400 models(c) AllRanges (15 fragments) of 8 sets of 150 models/set = 1200 models(d) ) Random in Input Domain of 8 sets of 150 models/set = 1200 models

Total of 3200 models with multiple Alloy solutions (10) per fragment

Time to automatically discover: 3 hours on MacBook Pro with Intel Core Duo processor and 2GB of RAM

Time for mutation analysis: 7 days on a grid. Executing 200 mutant transformations for each 3200 models

Page 58: Automatic Effective Model Discovery

58

Mutation Analysis

Y-axis Mutation Score

X-axis Test Strategy

Page 59: Automatic Effective Model Discovery

59

Mutation AnalysisAllPartitions (93.3%) AllRanges (92.27%)

Page 60: Automatic Effective Model Discovery

60

Summary of Model Discovery1. Automatic Discovery of Effective Models is

Possible!1.1 We present a software framework to transform knowledge from various sources to a CSP in Alloy1.2 We solve the CSP in Alloy model to discovery models

2. Empirical studies validate the effectiveness of models!

2.1 Automatically discovered test models help us detect 93 % bugs in the UML2RDBMS transformation!

3. The whole approach is implemented in the tool “Pramana” previously known as “Cartier” conforming to industry standard inputs

Page 61: Automatic Effective Model Discovery

61

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 62: Automatic Effective Model Discovery

62

Product DiscoveryFeature Diagram (FD)

specifies a set of product configurations

How to automatically discover effective products for a given objective?

Page 63: Automatic Effective Model Discovery

63

Motivating Example

E-Health Emergency Composite Service

Insurance Service

Treatment Service

Ambulance Service

Documentation Service

Page 64: Automatic Effective Model Discovery

64

E-Health Service Workflow

Atomic Services in a Workflow

Page 65: Automatic Effective Model Discovery

65

Variability in E-Health Service

E-Health Emergency Serviceis a

DYNAMIC SERVICE

In Traffic Jam!Choices in Insurance

Page 66: Automatic Effective Model Discovery

66

Reconfiguration of Workflow

Page 67: Automatic Effective Model Discovery

67

Variation Captured in a Feature Diagram

CHOICEMANDATORY

OPTIONAL

Page 68: Automatic Effective Model Discovery

68

Variability in E-Health Composite Service

reconfigures

Removing unselected services

Orchestration Workflow

Selection of a set of features

Page 69: Automatic Effective Model Discovery

69

All Possible Configurations

53,248 Configurations!

Page 70: Automatic Effective Model Discovery

70

Variation in QoS such as Response Time

53,248 Possible “response time distributions” for E-health!

(Based on Sidney et. al. “Probabilistic QoS and soft contracts for transaction based Web services”, ICWS 2010)

Example response time distributions

Page 71: Automatic Effective Model Discovery

71

Can this sample be used to better analyze E-health’s overall QoS ?

Is there small but effective set of configurations that widely samples the configuration space?

Page 72: Automatic Effective Model Discovery

72

How do we sample?

What are the configurations that cover all

pairwise interactions between features (or services)?

J. Czerwonka, “Pairwise Testing in Real World”Proceedings of 24th Pacific Northwest Software Quality Conference, 2006

Page 73: Automatic Effective Model Discovery

73

Pairwise InteractionsAmbulance_f Doctor_s

Pair1 N/A N/A

Pair2 N/A A

Pair3 A N/A

Pair4 A A

Eg: Pairs say what must be in a configuration that satisfy it. Total of 2380 pairs

Page 74: Automatic Effective Model Discovery

74

We discover only 185 configurations covering all valid pairs in the 2380 feature interaction pairs

Configuration Discovery Methodology

Feature Diagram FD

T-wise StrategyT (Eg. T=2 implies pairwise)

1. FD2Alloy

2. Generation of Alloy Predicates for Tuples (pairs for T=2)

Alloy Model

3. Detection of Consistent Tuples (w.r.t FD)

4. Generate Configurationscovering valid pairs

(Divide and Compose)

Page 75: Automatic Effective Model Discovery

Resulting Variation in QoS for 185 Configurations

75

Page 76: Automatic Effective Model Discovery

Box Plot of 37 configurations out of 185 configurations

76

Y-axis Response Time

X-axis Configurations

Prob

abili

ty D

istrib

ution

Page 77: Automatic Effective Model Discovery

Box Plot of 37 configurations out of 185 configurations

77

Extreme cases show up

Only mandatory services

Maximum number of services

Robust Determination of Service Level Agreement

Page 78: Automatic Effective Model Discovery

78

Summary of Product Discovery

1. Automatic Discovery of Effective Product Configurations is Possible!1.1 This thesis presents a software framework to transform a feature diagram and T-wise interactions to a CSP in Alloy to discover products

2. Empirical studies validate the effectiveness of products!

2.1 We automatically discover configurations of a dynamic web service that helped determine better SLA (In collaboration with Ajay Kattepur, Team DISTRIBCOM)2.2 Two large case studies: Crisis Management, E-Health

3. The whole approach is implemented in the tool “Avishkar”

Page 79: Automatic Effective Model Discovery

79

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 80: Automatic Effective Model Discovery

80

Conclusion1. Can we automatically discover effective models and

products ? Answer: Yes!

2. Were we able to qualify discovery using empirical studies? Answer: “Yes! Eg. Via mutation analysis in “Test Model Discovery”

3. Is there a software prototype for automatic model discovery? Answer: Yes! “Pramana” (previously Cartier)

4. Did we apply the general approach to other domains? Answer: Yes! The domain of Feature Diagrams implemented in tool “Avishkar”

5. Were we able to qualify product discovery using empirical studies? Answer: Yes! To “sample QoS and determine SLA” in a composite dynamic service

Page 81: Automatic Effective Model Discovery

81

Conclusion8. Any key scientific contributions?

Answer:In our opinion,

a) First results in automatic discovery of models satisfying knowledge from various sources. Notably discovery of test models! Why not other forms of discovery?

b) We leverage the idea of model transformations to scale formal methods to address very specific and modular needs (Eg. using metamodel pruning) in MDE. Theory truly meets practice!

c) Automatic discovery facilitates large-scale empirical studies in MDE

Page 82: Automatic Effective Model Discovery

82

Outline

Context and Problem The Solution Model Discovery Product Discovery Conclusion Future Work

Page 83: Automatic Effective Model Discovery

83

Future Work1. Discovery of large and complex models using

discovery of small models followed by their composition.

2. Discovery of models using feedback knowledge from fitness computation

3. What John Koza did with “Genetic programming” we want to do with “Automatic effective model discovery”!

4. Industrial Impact: Automatic discovery and composition of products in a Very Large Feature Diagram (Video Surveillance System from Keeneo) for a given intention.

Page 84: Automatic Effective Model Discovery

84

PublicationsJOURNAL ARTICLES (During Thesis)

(12) Sen S., Moha N. Baudry B., Mahe V., Barais Olivier, and J.-M.Jezequel, Reusable Model Transformations 2010 (Under Review) (11) Sen S., Mottu J.M. Baudry B., Automatic Model Generation for Transformation Testing 2010 (Under Review)(10). N. Moha, Sen S., Faucher C., Barais O., and J.-M.Jezequel, Evaluation of Kermeta on Graph Transformation Problems, Journal of

Software Tools and Technology Transfer, 2010(9). Sen S., B. Baudry, Vangheluwe H., Towards Domain-specific Model Editors with Automatic Model Completion, Simulation :

Transactions of the Modeling and Simulation Society, 2009

CONFERENCE ARTICLES (During Thesis)

(8) Kattepur Ajay, Sen S., Baudry B., Beneveniste A., Jard C. Variability Modeling and QoS Analysis of Web Services Orchestrations(7) G. Perrouin, Sen S., Klein J., Baudry B, Le Traon Yves, Automated and Scalable T-wise Test Case Generation Strategies for Software Product Lines, ICST 2010(6) Sen, S., N. Moha, B. Baudry, and J.-M.Jezequel, Meta-model Pruning. In Proceedings of MoDeLs. 2009. (5) Sen, S., B. Baudry, and J.-M. Mottu. Automatic Model Generation Strategies for Model Transformation Testing. In Proceedings of International Conference on Model Transformation. 2009(4) Sen S., Baudry B., Mottu Jean-Marie. On Combining Multi-formalism Knowledge to Select Models for Model Transformation Testing. ICST'08, 2008 (3) Sen S., Baudry B. Partial Model Completion in Model Driven Engineering. In Proc. of International Conference of Applications of Declarative Programming 2007(2) Sen S., Baudry B., Vangheluwe Hans, Domain Specific Model Editors with Model Completion, LNCS vol. on Models in Software Engineering,Workshops and Symposia at MoDELS 2007 (Best Paper)(1) Sen S., and Baudry B., Mutation-based Model Synthesis in Model Driven Engineering, Proc of IEEE ISSRE, Mutation Workshop. 2006

Model Discovery ArticlesEffective Modelling Domain ArticlesProduct Discovery Articles

Page 85: Automatic Effective Model Discovery

85

THANK YOU

I AM PLEASED TO ADDRESS YOUR QUESTIONS