## 3 Computer-Aided Product Family Modeling
### Formalization of Product Family Models
#### 3.3.1 Template-Based Feature Modeling  
Template-based feature modeling is achieved through PFA knowledge. A PFA template library consists of a set of templates, each template is used to express a type of PFA. The PFA template consists of two important elements: one is the information needed to form the corresponding PFA, and the other is a set of rules that determine the resulting PFA expression. We use templates as a knowledge base to express the corresponding PFA relationships, and build templates in the tool to generate guidance. Templates are used for the creation and evolution of feature models. We define the PFA template as a triplet. **Definition 4**. : _A PFA template is a triplet (N, E, exp) where N is the name of the template E is {elements} exp is C\(\rightarrow\)PFA expressions_  
\(N\) is the unique identifier of the template. \(E\) is a set of elements to be clarified, _exp_ to satisfy the mapping relationship C\(\rightarrow\)_PFA_ expressions, it is to generate the corresponding PFA expressions for different requirements. C is the set of conditions. The PFA expressions are a set of strings, each of which is a PFA expression. PFA expressions are used for the relationships between elements in \(E\). Individual features do not need to be connected, and multiple features are connected by symbols {-, +, opt[], (),-}. Based on the above definition, we define four templates: multiple, alternative, or-group, and constraint. Two example templates are given for the sake of space. The multiple template definition is shown in Table 1.  
The name of the template is _multiple_, which is used to describe the splitting of a feature into multiple unrelated sub-features. \(E\) is the set of elements to be given in the template again, containing the parent feature, the child feature, and the type of the child feature. The sub-features name are {\(e_{1},e_{2},\ldots,e_{n}\)}. The types of \(e_{i}\in\) childE is mandatory or optional. There are three cases of _PFA expressions_ depending on the _exp_. The types of features in _childE_ are all mandatory, the types of features in _childE_ are all optional, and the types of features in _childE_ are both mandatory and optional. Figure 1: Computer-aided formalization framework for product family model. The constraint template definition in Table 2:  
The name of this template is constraint. This template is used to describe the constraint relationship between two features. \(E\) contains two element \(\{f_{1},\text{T}(f_{1})\}\) and \(\{f_{2},f_{2 type}\}\). T(f) is a mapping of feature f to the {include, exclude}. The first element is the set of constrained features with the constraint type, and the second element is the constrained feature and its type. Constraint types consist of include and exclude. \(f_{1}\) include \(f_{2}\) means that the existence of \(f_{1}\) depends on \(f_{2}\). \(f_{1}\) exclude \(f_{2}\) means that there does not exist a product that makes \(f_{1}\), \(f_{2}\) exist at the same time. PFA provides advanced mechanisms for describing various aspects of product families such as their relations. Only basic expressions for individual feature models are included since this paper focuses on the connection between feature model and specifications. Others will be studied in the future to enrich our modeling approach. Templates are used for the creation and evolution of feature models. The template turns the PFA knowledge into guidance to assist the user in using PFA without understanding it. The elements within the template are then formed into PFA expressions by the corresponding algorithm (as shown in Algorithm 1) The tool then converts the PFA expression into the corresponding feature model. Give the feature \(f\) to be split, and all the elements in \(E\). Display all sub-features of feature f in the template. After finishing the modification of \(f\), the corresponding PFA expressions are generated according to the conditions in \(exp\).