F eature D iagrams & L ogic T here and B ack A gain Krzysztof - - PowerPoint PPT Presentation

f eature d iagrams l ogic t here and b ack a gain
SMART_READER_LITE
LIVE PREVIEW

F eature D iagrams & L ogic T here and B ack A gain Krzysztof - - PowerPoint PPT Presentation

F eature D iagrams & L ogic T here and B ack A gain Krzysztof Czarnecki University of Waterloo Andrzej W asowski IT University of Copenhagen F eature M odels car F eature M odels car body engine gear keyless-entry power-locks F


slide-1
SLIDE 1

Feature Diagrams & Logic There and Back Again

Krzysztof Czarnecki

University of Waterloo

Andrzej W ˛ asowski

IT University of Copenhagen

slide-2
SLIDE 2

Feature Models

car

slide-3
SLIDE 3

Feature Models

car power-locks keyless-entry gear engine body

slide-4
SLIDE 4

Feature Models

car power-locks keyless-entry gear engine body electric gas manual automatic

slide-5
SLIDE 5

Feature Models

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

slide-6
SLIDE 6

Feature Models

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

Model variability & commonality.

slide-7
SLIDE 7

Feature Models

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

Model variability & commonality. Standard semantics:

φ(car, body, engine, gear, . . . )

slide-8
SLIDE 8

Semantics

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

φ

slide-9
SLIDE 9

Reverse Engineering Syntax

?

φ

slide-10
SLIDE 10

Reverse Engineering Syntax

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

φ

slide-11
SLIDE 11

Reverse Engineering Syntax

a → c a b c c a b a b c a, c b

φ

slide-12
SLIDE 12

Reverse Engineering Syntax

a b c

φ

slide-13
SLIDE 13

Contents

Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks

slide-14
SLIDE 14

Contents

Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks

slide-15
SLIDE 15

Theoretical Motivation

To deepen understanding of feature models To explore the relation between logics and FMs To characterize formulæ that are FMs without leftover constraint

slide-16
SLIDE 16

Applied Motivation

To visualize variability given as systems of constraints.

slide-17
SLIDE 17

Applied Motivation

To visualize variability given as systems of constraints. To guide the user interactively in visualizing constraints.

slide-18
SLIDE 18

Applied Motivation

To visualize variability given as systems of constraints. To guide the user interactively in visualizing constraints. To support refactoring tools.

slide-19
SLIDE 19

Applied Motivation

To visualize variability given as systems of constraints. To guide the user interactively in visualizing constraints. To support refactoring tools. To support reverse engineering FMs from code.

slide-20
SLIDE 20

Contents

Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks

slide-21
SLIDE 21

Syntax: Going There

f

Solitary [1..1] → mandatory

slide-22
SLIDE 22

Syntax: Going There

f

Solitary [1..1] → mandatory

f

Solitary [0..1] → optional

slide-23
SLIDE 23

Syntax: Going There

f

Solitary [1..1] → mandatory

f

Solitary [0..1] → optional

f

Solitary [0..1] → grouped

slide-24
SLIDE 24

Syntax: Going There

f

Solitary [1..1] → mandatory

f

Solitary [0..1] → optional

f

Solitary [0..1] → grouped Group [1..1] → xor-group

slide-25
SLIDE 25

Syntax: Going There

f

Solitary [1..1] → mandatory

f

Solitary [0..1] → optional

f

Solitary [0..1] → grouped Group [1..1] → xor-group Group [1..k] → or-group

slide-26
SLIDE 26

Syntax: Going There

f

Solitary [1..1] → mandatory

f

Solitary [0..1] → optional

f

Solitary [0..1] → grouped Group [1..1] → xor-group Group [1..k] → or-group

φ

Left-over constraints

slide-27
SLIDE 27

Semantics: Going There

a b c d e f

a b c d e f

a c ∨ e f

slide-28
SLIDE 28

Semantics: Going There

a b c d e f

a b c d e f

a c ∨ e f

a b c d ∨ e f

An implication (hyper)graph

slide-29
SLIDE 29

Contents

Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks

slide-30
SLIDE 30

Why Is It So Hard?

1. Possibly no models corresponding to φ

slide-31
SLIDE 31

Why Is It So Hard?

1. Possibly no models corresponding to φ 2. Possibly many models corresponding to φ

a → c a b c c a b a b c a, c b

slide-32
SLIDE 32

Why Is It So Hard?

1. Possibly no models corresponding to φ 2. Possibly many models corresponding to φ

a → c a b c c a b a b c a, c b

3. Brute-force infeasible

slide-33
SLIDE 33

Root Feature

Property The root of a feature tree Test A variable r implied by all the

  • ther variables:

for all i. φ → (fi → r)

slide-34
SLIDE 34

Root Feature

Property The root of a feature tree Test A variable r implied by all the

  • ther variables:

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

body → car, gas → car, . . .

slide-35
SLIDE 35

Feature Hierarchy

Property

f is an ancestor of g (descendant)

Test Implication from descendant (g) to ancestor (f)

g → f

slide-36
SLIDE 36

Feature Hierarchy

Property

f is an ancestor of g (descendant)

Test Implication from descendant (g) to ancestor (f)

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

body → car, gas → car, . . .

slide-37
SLIDE 37

Feature Hierarchy

Property

f is an ancestor of g (descendant)

Test Implication from descendant (g) to ancestor (f)

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

Direct links: transitive reduction

slide-38
SLIDE 38

Mandatory Features

Property

g is a mandatory subfeature of f

Test Biimplication between variables corresponding to g and f

f → g

slide-39
SLIDE 39

Mandatory Features

Property

g is a mandatory subfeature of f

Test Biimplication between variables corresponding to g and f

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

body → car, car → body, . . .

slide-40
SLIDE 40

And Groups

Property

g is a mandatory subfeature of f

Test Biimplication between variables corresponding to g and f

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

And-groups: cliques in the graph

slide-41
SLIDE 41

Or Groups

Recall that for an or-group:

φ → (f → f1 ∨ · · · ∨ fk)

But then also

φ → (f → f1 ∨ · · · ∨ fk ∨ g)

holds for g other than fi.

slide-42
SLIDE 42

Or Groups

Implied disjunction can always be weakened! All implied disjunctions =

  • versized and too-many or-groups

So detect minimal disjunctions

slide-43
SLIDE 43

Or Groups

Implied disjunction can always be weakened! All implied disjunctions =

  • versized and too-many or-groups

So detect minimal disjunctions

{fi}i=1..k is a prime implicant of f

(see the paper) Prime implicants are well studied in fault tolerance analysis

slide-44
SLIDE 44

Or Groups

Property Or-groups of features rooted in f Test Find prime implicants of f

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

electric ∧ gas → engine

slide-45
SLIDE 45

Or Groups

Property Or-groups of features rooted in f Test Find prime implicants of f

car power-locks keyless-entry gear engine body electric gas manual automatic keyless-entry→power-locks

manual ∧ electric ∧ gas → engine

slide-46
SLIDE 46

Algorithm

1 if unstatisfiable then quit 2 remove & report dead features 3 compute implication graph & its transitive reduction 4 find and-groups by contracting cliques 5 find all or-groups and xor-groups candidates

slide-47
SLIDE 47

Contents

Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks

slide-48
SLIDE 48

Discussion (I)

Constructs an overapproximation (add a leftover constraint) The graph constructed contains maximum information (complete)

slide-49
SLIDE 49

Discussion (I)

Constructs an overapproximation (add a leftover constraint) The graph constructed contains maximum information (complete) Implemented using BDDs, algorithm by Coudert&Madre,1992 Efficient and scalable (computing prime implicants is the bottleneck)

slide-50
SLIDE 50

Discussion (II)

Semantic operations on feature models become logical operations

  • n corresponding formulæ

Merge: (φFM1 → r) ∧ (φFM2 → r) Difference: φFM1 ∧ ¬φFM2 ...

slide-51
SLIDE 51

Future Work

Generalize the kind of models extracted beyond FODA Implement complex refactorings using logical representations Experiment with extracting models from code

slide-52
SLIDE 52

Summary

Successful exercise in semantics Exhibited links between logical & relational phenomena and FMs

implication graphs, transitive reduction, cliques, prime implicants

Effective extraction procedure Implemented Suggested ideas for future work