# 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
* **Objective:** The optimization function of the COP is the minimization of the total time, it implies to minimize the value of \(T\) (minimization(\(T\))). Table 1 gives a summary of the equivalence of the elements of the formalization and the COP built. The solving of the COP will obtain a pair of start and end instants of time for each activity that minimizes any instantiation time (\(T\)) for the model. As mentioned earlier, the minimum execution time of an activity is modelled as a \(t^{A^{i}}\) units of time. But it is possible to obtain the same value of (\(T\)), where the execution time is minimized, with different \(t_{ini}^{A^{i}}\) and \(t_{end}^{A^{i}}\) for the same problem. Suppose activities (\(A_{1}\), \(A_{2}\), \(A_{3}\) and \(A_{4}\)) that last a unit of time, where the input data of \(A_{4}\) depends on the output of \(A_{1}\), and the input data of \(A_{3}\) depends on the output of \(A_{4}\). Figure 7 depicts two possible configurations (a) and (b) that minimize the theoretical execution time (\(t_{3}\)). However, there exist more variations, since \(A_{2}\) can be executed in a parallel way with any of the other activities. Although both options (a) or (b) are optimal according time consuming, the model of Figure 7b is better than the model of Figure 7a, since it supports an unexpected delay of \(A_{2}\) executing, not increasing the total execution time (\(t_{3}\)). To make the imperative model more robust to unexpected delays, we propose to modify the proposed COP to find the most paralleled process. To this end, the COP must find the greatest value of \(t_{end}^{A^{i}}\) for each \(A_{i}\). It is obtained including the \(t_{ini}^{A^{i}}\) variables as a goal in the COP, and leaving the domain of \(t_{end}^{A^{i}}\) open during the search. Then, the \(t_{ini}^{A^{i}}\) variables will be instantiated during the propagation phase, while all the possible values of the domains of \(t_{end}^{A^{i}}\) variables will be obtained as solutions of the COP for each value of \(t_{ini}^{A^{i}}\). The greatest value of the \(t_{end}^{A^{i}}\) domain is the most appropriate value to build an imperative robust business process model. \begin{table}
\begin{tabular}{l c} \hline \hline
**Declarative** & **COP** \\ \hline Activity & \(\langle t_{ini},t_{end}\rangle\) \\ PDI, ADI, PDO, ADO & Variables \\ Numerical Constraints (Input and Output Constraints) & Temporal Constraints \\ Pre and Post Conditions & Activity Definition \\ Objective Function & Minimize Total Time \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Declarative model and COP elements relationship. Algorithm 1 describes the creation of the COP from a declarative specification as explained before. ```
1:Create variable: \(int\;TStart=0\)
2:Create variable: \(int\;\mathbb{T}End=0.\sum_{i=1}^{n}t^{A^{i}}\)
3:for each \(Activity(A_{i})\)do
4: Create a variable: \(int\;t_{ini}^{A^{i}}=0.\sum_{i=1}^{n}t^{A^{i}}\)
5: Create variable: \(int\;t_{end}^{A^{i}}=0.\sum_{i=1}^{n}t^{A^{i}}\)
6:endfor
7:for each \(Activity(i)\)do
8: Create constraint: \((t_{ini}^{A^{i}}+t^{A^{i}})\leq t_{end}^{A^{i}}\)
9: Create constraint: \(TEnd\geq(t_{end}^{A^{i}}+t^{A^{i}})\)
10:endfor
11:for each \(ADO_{i}=ADI_{i}\), where an output of \(Activity\)\(i\) is related to the input of \(Activity\)\(j\)do
12: Create constraint: \((t_{end}^{A^{i}}+t^{A^{i}})=t_{ini}^{A^{i}}\)
13:endfor
14: Define goal variables: \(\{\;(t_{end}^{A^{1}}+t^{A^{1}}),..,(t_{end}^{A^{n}}+t^{A^{n}}),TEnd\;\}\)
15: Define objective function: \(Minimize\;(TEnd-TStart)\)
```  
**Algorithm 1** Creation of a COP from a Declarative Specification.