# Business Process Configuration according to Data Dependency Specification
## 4 Conf-BP Framework: A Configurable System to Create Imperative BP
### Automatic Transformation from Declarative to Imperative Model
#### 4.3.1 Configuration of a BP Model: Creating a COP from the Declarative Model  
The relation between the input and output of the activities determines their relational order. For the same declarative model, it is possible to find several configurations of activities that satisfy the requirements and description. To find the best configuration, we propose the use of an intelligent system to find the optimal BP model that maximizes the parallelism of the activities, with the aim of minimizing the execution time. To determine this configuration, we suggest the transformation of the declarative model into a COP, to analyze the possible instant when the activities can start and end their executions, according to data dependency. Firstly, and before to explain how to create the COP, it is necessary as a previous step to ascertain the data relation, especially when they are included in the IF-THEN constraints of the description of the problem. The definition of Tuple of Condition-Relation in order to introduce this relation is introduced. **Definition 8**. : _A Tuple of Condition-Relation is a tuple formed of \(\langle Condition\), \(Activity\)\(1\), \(Activity\)\(2\rangle\), where Condition represents under which condition \(Activity\)\(2\) is executed after \(Activity\)\(1\). Therefore, the value true in the Condition implies that \(Activity\)\(2\) is always executed after \(Activity\)\(1\), or, in the case when the Condition contains an expression, \(Activity\)\(2\) is executed after \(Activity\)\(1\) if and only if the expression is met._  
These tuples are built analyzing the data relations found in the set of **INPUT_CONSTRAINT** and **OUTPUT_CONSTRAINT** that describe the declarative model. For each constraint where the output of an activity \(A_{i}\) is related to the input of an activity \(A_{j}\), a tuple is created. If the input-output relation appears in an IF-THEN constraint with a \(c\) condition, the tuple will be \(\langle c\), \(A_{i}\), \(A_{j}\rangle\), and \(\langle true\), \(A_{i}\), \(A_{j}\rangle\) otherwise. With the list of intervals and the list of tuples of data relations, the following COP is created:  
* **Variables:** The possible instants when each activity can be executed, are defined as the tuple of variables \(\langle t^{A_{i}}_{ini},t^{A_{i}}_{end}\rangle\), where \(t^{A_{i}}_{ini}\) is the instant of time in which the activity \(A_{i}\) begins, and \(t^{A_{i}}_{end}\) is the instant of time in which the activity \(A_{i}\) finishes. For each activity \(A_{i}\), the COP will include a couple of variables \(\langle t^{A_{i}}_{ini},t^{A_{i}}_{end}\rangle\). To represent the execution time of the whole process, the variable \(T\) is included, that represents the \(t_{end}\) of the last activity executed. If every activities is executed in parallel, \(T\) will be the maximum value of \(t^{A_{i}}\), but if every activities are executed sequentially, the value of \(T\) will be the summation of every \(t^{A_{i}}\). * \(t^{A_{i}}_{ini}\): \(0..(\sum_{1..j..N}t^{A^{i}})-t^{A^{i}}\)
\(t_{end}^{A_{i}}\): \(t^{A^{i}}\): \(t^{A^{i}}\)..(\(\sum_{1..j..N}t^{A^{j}}\)) * T: \(\max\{t^{A^{i}}\}\)..\(\sum_{1..j..N}t^{A^{j}}\)  
* The necessary constraint to model the COP are:
* It is mandatory that for every activity \(A_{i}\), \(t_{ini}^{A_{i}}+t^{A^{i}}\leq t_{end}^{A_{i}}\)
* \(T\) has to be the greatest value of t\({}_{end}\), then T \(\geq t_{end}^{A_{i}}\) for every A\({}_{i}\). * For each element of the list of tuples building by using the data relations, a numerical constraint is included in the COP. Each relation between data input and output in the way \(\langle c\), \(A_{j}\), \(A_{i}\rangle\) is translated into the constraint \(t_{ini}^{A_{i}}\geq t_{end}^{A_{j}}\). For example, in the trip planner, the constraint \(\{A_{H}.checkInDate=A_{F}.outwardArrivalDate\}\) is translated into \(t_{ini}^{A_{H}}\geq t_{end}^{A_{F}}\). Therefore, all the activities could start at the same instant unless there exists a relationship requiring one activity to start after another.