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 eature M odels car body engine gear keyless-entry power-locks electric gas manual automatic
F eature M odels keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic
F eature M odels keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic Model variability & commonality.
F eature M odels keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic Model variability & commonality. Standard semantics: φ ( car , body , engine , gear , . . . )
S emantics keyless-entry → power-locks φ car body engine gear keyless-entry power-locks electric gas manual automatic
R everse E ngineering S yntax φ ?
R everse E ngineering S yntax keyless-entry → power-locks φ car body engine gear keyless-entry power-locks electric gas manual automatic
R everse E ngineering S yntax φ a c a a, c b c a b c b a → c b
R everse E ngineering S yntax φ a b c
C ontents Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks
C ontents Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks
T heoretical M otivation To deepen understanding of feature models To explore the relation between logics and FMs To characterize formulæ that are FMs without leftover constraint
A pplied M otivation To visualize variability given as systems of constraints.
A pplied M otivation To visualize variability given as systems of constraints. To guide the user interactively in visualizing constraints.
A pplied M otivation To visualize variability given as systems of constraints. To guide the user interactively in visualizing constraints. To support refactoring tools.
A pplied M otivation 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.
C ontents Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks
S yntax: G oing T here f Solitary [1..1] → mandatory
S yntax: G oing T here f Solitary [1..1] → mandatory f Solitary [0..1] → optional
S yntax: G oing T here f Solitary [1..1] → mandatory f Solitary [0..1] → optional f Solitary [0..1] → grouped
S yntax: G oing T here f Solitary [1..1] → mandatory f Solitary [0..1] → optional f Solitary [0..1] → grouped Group [1..1] → xor-group
S yntax: G oing T here 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
S yntax: G oing T here 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
S emantics: G oing T here a a a b c d c ∧ b c d ∨ e f e f e f
S emantics: G oing T here a a a b c d c ∧ b c d ∨ e f e f e f a b c d ∨ e f An implication (hyper)graph
C ontents Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks
W hy I s I t S o H ard? 1. Possibly no models corresponding to φ
W hy I s I t S o H ard? 1. Possibly no models corresponding to φ 2. Possibly many models corresponding to φ a c a a, c b c a b c b a → c b
W hy I s I t S o H ard? 1. Possibly no models corresponding to φ 2. Possibly many models corresponding to φ a c a a, c b c a b c b a → c b 3. Brute-force infeasible
R oot F eature P roperty The root of a feature tree T est A variable r implied by all the other variables: for all i . φ → ( f i → r )
R oot F eature P roperty The root of a feature tree T est A variable r implied by all the other variables: keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic body → car , gas → car , . . .
F eature H ierarchy P roperty f is an ancestor of g (descendant) T est Implication from descendant ( g ) to ancestor ( f ) g → f
F eature H ierarchy P roperty f is an ancestor of g (descendant) T est Implication from descendant ( g ) to ancestor ( f ) keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic body → car , gas → car , . . .
F eature H ierarchy P roperty f is an ancestor of g (descendant) T est Implication from descendant ( g ) to ancestor ( f ) keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic Direct links: transitive reduction
M andatory F eatures P roperty g is a mandatory subfeature of f T est Biimplication between variables corresponding to g and f f → g
M andatory F eatures P roperty g is a mandatory subfeature of f T est Biimplication between variables corresponding to g and f keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic body → car , car → body , . . .
A nd G roups P roperty g is a mandatory subfeature of f T est Biimplication between variables corresponding to g and f keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic And-groups: cliques in the graph
O r G roups Recall that for an or-group: φ → ( f → f 1 ∨ · · · ∨ f k ) But then also φ → ( f → f 1 ∨ · · · ∨ f k ∨ g ) holds for g other than f i .
O r G roups Implied disjunction can always be weakened! All implied disjunctions = oversized and too-many or-groups So detect minimal disjunctions
O r G roups Implied disjunction can always be weakened! All implied disjunctions = oversized and too-many or-groups So detect minimal disjunctions { f i } i = 1.. k is a prime implicant of f (see the paper) Prime implicants are well studied in fault tolerance analysis
O r G roups P roperty Or-groups of features rooted in f T est Find prime implicants of f keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic electric ∧ gas → engine
O r G roups P roperty Or-groups of features rooted in f T est Find prime implicants of f keyless-entry → power-locks car body engine gear keyless-entry power-locks electric gas manual automatic manual ∧ electric ∧ gas → engine
A lgorithm 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
C ontents Motivation Syntax & Semantics (going there) Algorithm (going back again) Concluding remarks
D iscussion (I) Constructs an overapproximation (add a leftover constraint) The graph constructed contains maximum information (complete)
D iscussion (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)
D iscussion (II) Semantic operations on feature models become logical operations on corresponding formulæ Merge: ( φ FM 1 → r ) ∧ ( φ FM 2 → r ) Difference: φ FM 1 ∧ ¬ φ FM 2 ...
F uture W ork Generalize the kind of models extracted beyond FODA Implement complex refactorings using logical representations Experiment with extracting models from code
S ummary 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
Recommend
More recommend