## 2 Materials and Methods
### Opportunistic Grouping Strategy for the Preventive Maintenance Plan
#### 2.2.1 Maintenance Grouping Strategy Framework Formulation
Therefore, the existence of grouping schemes generates that \(t^{f}_{i,\ j}-t^{s}_{i,\ j}\geq p_{i}\), given the difference between the repair times of the activities involved (See Figure 3b). Therefore, it is necessary to distinguish the unavailability time \(r_{i,\ j}\), versus its individual execution time \(p_{i}\), for each of the executions \((i,\ j)\in I\times J_{i}\). This is necessary considering the relationship between the completion time and the start time of the same activity, i.e., \(t^{f}_{i,\ j}-t^{s}_{i,\ j}=r_{i,\ j}\geq p_{i}\). In this way, the unavailability time for each execution \((i,j)\) is determined by the occurrence of the grouping schemes, which is formally expressed as  
\[r_{i,j}=\max_{ \begin{array}{c}i,i^{\prime}\in I:\\ i\
eq i^{\prime},\\ z_{i,j,i^{\prime},i^{\prime}}=1\end{array} }\{p_{i^{\prime}}\} \tag{4}\]  
where \(z_{i,\ j,\ i^{\prime},\ j^{\prime}}\) represents a grouping binary variable which takes the value of 1 if the pairs \((i,\ j)\) and \((i^{\prime},\ j^{\prime})\) form a work package (or equivalently, an opportunistic group). As indicated above, the resumption time of a finished execution can be modified due to the formation of grouping schemes, which affect the future planning of the execution times. Besides, considering that \(t^{s}_{i,\ j}\) and \(t^{f}_{i,\ j}\) depend on \(r_{i,\ j}\), which in turn depends on the grouping decision (i.e., the value of the binary variable \(z_{i,\ j^{\prime},\ j^{\prime}}\)), it is not possible to determine a priori the set of values \(\left\{t^{s}_{i,\ j^{\prime}},\ t^{f}_{i,\ j}\right\}_{i\in I,\ j\in I_{i}}\). Therefore, considering that \(J_{i}\) corresponds to a known parameter, the following procedure will be considered to determine the number of scheduled executions:  
\[J_{i}=\Big{\{}j\in J_{i}:j=1,2,\ldots,\big{\lfloor}\ \frac{T}{r+T_{i}+e_{i}T_{i}}\ \big{\rfloor}\Big{\}},\ \forall i\in I \tag{5}\]  
Figure 3: (**a**) Impact of the grouping strategy on the periodicity and tentative executions; (**b**) impact of grouping schemes over the system unavailability. where \(\overline{r}=\max\limits_{i\in I}\{p_{i}\}\). Once \(J_{i}\) has been determined, it is then necessary to determine the feasibility of the groupings between the different activities that compose the PM plan. Considering that the time-window tolerances impose grouping feasibility constraints, a search algorithm is proposed in order to explore feasible grouping schemes, thus improving the processing time of the optimization model. The search Algorithm 1 is presented below:  
```
Input: Store \(p_{i},J_{i},\ \forall i\in I\)
1:\(\mathbf{P}\leftarrow\{p_{i}:i\in I\}\); \(N\leftarrow[\ ]\)
2:\(C=0\)
3: For each \(i\in I\):
4:\(C\gets C+|J_{i}|\)
5:\(\mathbf{R}\leftarrow\mathbf{P}^{c}\) (generate cartesian product set)
6: For each instance \(\mathbf{p}\in\mathbf{R}\):
7:\(r\leftarrow[\ ]\), \(N_{p}\leftarrow[\ ]\), \(M\leftarrow[\ ]\)
8: For each \(i\in I,j\in J_{i}\):
9:\(p_{i,j}\leftarrow\mathbf{p}[i,j]\)
10:\(r_{i,j}\leftarrow\mathbf{p}_{i,j}\)
11:\(r[i,j]\gets r_{i,j}\)
12: For each \(i\in I\):
13: Calculate and store \(N_{i}\) with \(r[i,\ ]\)
14: For each \(i,i^{\prime}\in I\):
15:\(N_{p}=\{(i,j^{\prime},r^{\prime},j^{\prime}):\ i^{\prime}>i\wedge N_{i}\cap N _{i^{\prime}}\
eq\varnothing\}\), \(\forall\ j\in J_{i^{\prime}},j^{\prime}\in J_{i^{\prime}}\)
16: If \(N_{p}\
eq\varnothing\) :
17: For each \((i,j,n,o)\in N_{p}\):
18: Add \((i,j,n,o)\) to \(M\)
19: For each \((i,j,n,o)\in M\) :
20: If \((i,j,n,o)\
otin N\):
21: Add grouping pair \((i,j,n,o)\) to \(N\)
```  
**Algorithm 1**Generation of feasible PM grouping pairs  
The algorithm begins by generating a set of arbitrary values \(\left\{r_{i,\ j}\right\}_{i\in I,\ j\in I}\), obtained from a sample of individual execution times \(\left\{p_{i}\right\}_{i\in I}\).