Feature Model Calculator

0.3.2

Download

The feature model calculator is still under heavy development. Please treat this software as a proof of concept. If you're willing to deal with potentially broken software, feel free to download the tool. If you discover a bug, please do report it to me.

MD5 checksum: 18fca9be975160cce271e03afd9f8d84

To run, execute the following command on the console:
java -jar -Xmx 512M fmcalc-0.3.2.jar

Overview

The Feature Model Calculator is a command-line Java application for performing semantic operations on feature models and propositional formulas. Feature models are converted into a propositional formula through a semantic operation. A propositional formula is converted to a generalized feature model through feature model synthesis or a basic feature model using the render operation. Expressions in the calculator can be one of two types:

The translation from feature models to propositional logic is based on the work by Don Batory: Feature Models, Grammars, and Propositional Formulas. Constructing a feature model from a propositional logic is based on the work by Czarnecki and Wąsowski: Feature Diagrams and Logics: There and Back Again.

Features and Operations

Note: A feature model is automatically converted into a propositional formula when needed. 
Assign a feature model to a variable in the calculator
var = ( FM | set | operation )

Example Usage:

a = { a: b? c?; c: (d|e); b->!c; }
b = a

View a graphical representation of a FM
view FM
FM

Opens a frame showing the feature diagram (FD) component of the feature model. If the FD is in the generalized notation (ie. one or more features have multiple parents), then the DAG layout is used, otherwise the FD is shown as a tree.

The view command can be omitted. view is the default action for feature models.

Example Usage:

view { a: b? c?; }
{ a: b? c?; }

a = { a: (b|c); }
view a
a

Intersect / Union Operation
φ (intersect|union) φ

Returns: Formula

Deselects absent variables prior to the propositional AND / OR.

Example Usage:

a = { a: b? c?; }
b = { a: b?; b: d; }
c = a intersect b
d = { a: (b|c)+; } union { a: (d|e)+; }

Render Operation
render φ FM1
  • FM1 - A feature model containing a hierarchy to be enforced

Returns: Feature Model

Example Usage:

a = { a: b? c?; }
b = { a: b?; b: d; }
c = a union b
d = render c a
view d

Feature Model Synthesis Operation
synth φ

Returns: a FM in generalized feature digram notation

Example Usage:

synth { b->a & c->a & b->(d|e); d->!e; }

Propositional AND / OR
φ (& or |) φ

Returns: Formula

Example Usage:

a = { a: b? c?; }
b = { d->c; }
c = a & b
d = a | b
view render c a b

Propositional NOT
!φ

Returns: Formula

Example Usage:

a = { a: b? c?; }
b = !a
c = a & b

Generate a random feature model
generate INT

Generates a random feature model with the specified number of parameters. Each feature may have 2 to 10 The generated model will have all its features evenly distributed among the following categories: mandatory, optional, or-group, xor-group and mutex-group. Extra constraints as added to the model with 20% ECR.

Returns: a FM

Example Usage:

a = generate 20
view a
view generate 100

Mutate a feature model
mutate FM

Applies 10 random mutations to the feature model. The resulting model may be a generalized feature model.

Returns: a FM

Example Usage:

a = generate 20
b = mutate a
c = mutate mutate b

Display a listing of variables
vars
Clear variables and feature domain
clear

Notes

Feature Model Grammar

input       := ( (production | expr ) ';')*

production  := ID ':' (child)+

child       := mandatory | optional | xor-group | or-group | mutex-group | and-group

mandatory   := ID
optional    := ID '?'
xor-group   := '(' ID  ('|' ID)+ ')'
or-group    := '(' ID  ('|' ID)+ ')' '+'
mutex-group := '(' ID  ('|' ID)+ ')' '?'
and-group   := (ID '=')? '(' ID ('&' ID)+ ')'

expr       := expr ('|' | '&' | '->' | '<->') expr
            | '!' expr
            | '(' expr ')'
            | ID

ID         := ('a'..'z'|'A'..'Z'|'0'..'9'|'_')+

Screenshot

Visualisation of a Feature Model

Screenshot of the Feature Model visualization

Credits

Calculator and semantic operations by Steven She. Feature model synthesis implementation by Andrzej Wąsowski. Visualization using the JUNG v2.0 framework.