Feature Models Introduction

The mass customization of software products is known as software product lines (SPL). In order to achieve customer’s personalization, software product line engineering promotes the production of a family of software products from common features instead of producing them one by one from scratch.

A feature model represents the information of all possible products of a software product line in terms of features and relationships among them. Feature models are visually represented by feature diagrams and textual syntax.

Example of a “complete” feature diagram :

And in the FAMILIAR formalism :

// laptop.fml
fmlaptop = FM (Laptop : Screen CPU RAM CG HDD Battery Connectivity [Warranty];
Screen : (s12|s15|s17);
CPU : (LowTDP|HighTDP);
LowTDP : (Atom270|AtomZ320);
HighTDP : (Core2T6600|Core2P7350) ;
RAM : (Kingstom2Go666|Kingstom4Go666|Corsair4Go1030);
CG : (Integrated|Standalone);
Integrated : GMA;
Standalone : (Nvidia8400M|Nvdia8600M|Nvidia3670|Nvidia9400M);
HDD : (WD160Go5400tr|WD500Go) ;
WD500Go : (S5400tr|S7200tr) ;
Battery : (cells6|cells9);
Connectivity : Wifi [Bluetooth];
Wifi : (ABG|N) ;
Warranty : (year2theft|year3theft);
Standalone -> HighTDP ;
LowTDP -> !Standalone;)

A feature is a visible and understanding characteristic of a product line. A feature diagram is a tree composed of features. At least one feature compose the tree : the root feature (on the laptop example, the feature laptop is the root feature).

Each feature has a special relationship with their child features (mutually exclusive) :

  • Mandatory : The child feature is included in all products in which its parent feature appears.
    Connectivity : Wifi [Bluetooth]; // Wifi is mandatory
    
  • Optional : The child feature is optionally included in all products in which its parent feature appears.
    Connectivity : Wifi [Bluetooth]; // Bluetooth is optional
    
  • Or : One or more child feature can be included in the products in which its parent feature appears.
    A : (B|C)+ ;
    
  • Xor : One and only one child feature can be included in the products in which its parent feature appears.
    Screen : (s12|s15|s17);
    

In addition with these relationships, cross-tree constraints are allowed.

  • Requires : If a feature B require a feature C, the inclusion of B in a product implies the inclusion of B in such product.
    Standalone -> HighTDP ;
    
  • Excludes : If a feature B excludes a feature C, both features cannot be part of the same product.
    LowTDP -> !Standalone;
    
  • More complex boolean expression :
    FM ( A : [B] C [D]; B : [E] [F]; F -> D; D -> !E ;)
    

A configuration is an instance of a particular Feature Diagram. A product is equivalent to a full configuration where only selected features are specified and omitted features are implicitly removed. You can use particular operations to manipulate a configuration.

The user can create in real time a configuration by using special operations : selecting / deselecting / unselecting feature. He can thus produce a finished product if he follows the rules described by the feature model. Each configuration not being a finished product, is a partial configuration.

A product example in graphical mode :

The same product example in textual mode :

selected: [Laptop, Screen, RAM, HighTDP, Nvdia8600M, CPU, N, Connectivity, CG, Corsair4Go1030, Standalone, Core2P7350, s17, S7200tr, Battery, HDD, Wifi, cells9, WD500Go]      
deselected: [Nvidia3670, Core2T6600, GMA, WD160Go5400tr, Atom270, Kingstom2Go666, Nvidia9400M, Kingstom4Go666, Nvidia8400M, cells6, LowTDP, S5400tr, AtomZ320, Integrated, ABG, s12, s15]

Auto propagation. This operation takes a feature model and a partial configuration as input and returns a new configuration with the features that should be selected and/or removed as a result of the propagation of constraints in the model. In the laptop example, if you select the feature Nvidia8600M, all brother features and the Integrated feature will be deselected.

FAMILIAR

FAMILIAR is an executable language that analyse automatically feature models and extract valuable information. It works in two steps. Firstly, the feature model is translated into FAMILIAR textual representation (FML). Secondly, the input is given to the solver to analyse it. The output can be saved in a file for later use. In your application, you can thus dedicate to FAMILIAR the processing of your product line variability.

FAMILIAR workflow example in a configurator case :

Off-the-shelf SAT solvers (i.e., SAT4J) and BDD library (i.e., JavaBDD) are internally used to perform FAMILIAR operations.

FAMILIAR support some operations for manipulating feature models and configurations:

  • Product list generation : this operation takes a feature model as input and returns all the products represented by the model. Simple example in FAMILIAR :
    fm1 = FM (A : [B] [C] [D];)
    configs fm1
    
    Produce in output :
    res0: (SET) {{D;A};{A;B;D};{C;B;A};{B;A};{A;C};{D;A;C};{A;C;D;B}}
    
  • Count the number of product : this operation takes a feature model as input and returns the number of products represented by the model. In the laptop example :
    counting m
    res6: (INTEGER) -113
    
  • Valid product : this operation takes a feature model and a product as input and determine whether the product belongs to the set of products or not. It takes into account anomalies detection like dead features, conditionally dead features and false optional features. A feature model is void if it represents no products. The reasons that may make a feature model void are related with a wrong usage of cross-tree constraint. In the laptop example :
    isValid fmlaptop
    res7: (BOOLEAN) true
    
  • Insert : this operation produces a feature model by inserting a feature model into another base or target feature model.
  • Rename feature : This operation sets a new name to a feature in a feature model.
  • Remove feature : This operation deletes a feature and its child features in a feature model.
  • Merge : this operation takes two feature models and tries to combine them to make one unique model containing all the variability of both FMs. Some alignment problems could require the user intervention.

Source : “Automated Analysis of Feature Models 20 Years Later : A Literature Review”. David Benavides, Sergio Segura and Antonio Ruiz-Cortés. Wikipedia

Attachments