## 3 Genetic Algorithm and Fuzzy Logic for the FjSSP
\tag{23}\]  
\[E_{j}^{*}=\frac{\int_{SE}x\mu_{Ej}(x)dx}{\int_{SE}x\mu_{Ej}(x)}=\frac{\int_{ SE}x\mu_{Cj}(x)dx}{\int_{SE}x\mu_{Cj}(x)} \tag{24}\]  
Figure 6: Cases of fuzzy tardiness and fuzzy earliness for each job \(j\) (**a**) tardiness or earliness; (**b**) no tardiness or earliness; (**c**) earliness; (**d**) tardiness. \[P_{j}^{E}=\frac{\int_{SE}\mu_{Ej}(x)dx}{\int_{S}\mu_{Cj}(x)}=\frac{\int_{SE}\mu_{Cj }(x)dx}{\int_{S}x\mu_{Cj}(x)} \tag{25}\]  
\[E_{j}=\left(d_{jA}-E_{j}^{*}\right)\times P_{j}^{E} \tag{26}\]  
\[T_{j}^{*}=\frac{\int_{ST}x\mu_{Tj}(x)dx}{\int_{ST}\mu_{Tj}(x)}=\frac{\int_{ST}x \mu_{Cj}(x)dx}{\int_{ST}\mu_{Cj}(x)} \tag{27}\]  
\[P_{j}^{T}=\frac{\int_{ST}\mu_{Tj}(x)dx}{\int_{S}\mu_{Cj}(x)}=\frac{\int_{ST}\mu _{Cj}(x)dx}{\int_{S}x\mu_{Cj}(x)} \tag{28}\]  
\[T_{j}=\left(T_{j}^{*}-d_{jB}\right)\times P_{j}^{T} \tag{29}\]  
Once the earliness and tardiness of job \(j\) (\(E_{j}\) and \(T_{j}\)) are obtained, Equation (30) calculates the total weighted penalty of the beta chromosome \(r\) or fitness value, considering the weight of earliness (\(W_{E}\)), the weight of lateness (\(W_{T}\)), and the weighting of job \(j\) (\(W_{j}\)). \[Z_{r}=\sum_{1}^{n}W_{j}\big{(}T_{j}\ W_{T}+E_{j}W_{E}\big{)} \tag{30}\]  
Step 5. After evaluating the beta chromosomes, they are ordered from lowest to highest according to their fitness value (total weighted penalty), and the best chromosomes are selected to form part of the next generation using the elitism rate (\(ET\times PB\)). Step 6. The crossover operator completes the next generation by randomly selecting two alpha chromosomes from the current population (parents), then determining with the crossover probability (PC) whether the crossover operation is performed on the parents; or two offspring are generated identically to the parents. In the case of applying the crossover to the selected parents, a single crossing point is randomly chosen to divide each parent into two crossing sections, which are exchanged to form two offspring, as shown in Figure 7.  
Figure 7: Crossover operator based on single crossing point. The mutation operator is applied after creating the offspring alphas, generating a random number for each offspring. If this random number is less than the probability of mutation MR, the mutation operation is performed using the swapping mutation method (exchange mutation), where two randomly chosen genes are exchanged through a SWAP movement [36,37] (see Figure 8). Step 7. After applying the crossover or mutation operator, infeasible offspring may be generated because one or more jobs do not have assigned the number of operations they require, so a job \(j\) appears more or fewer times in the offspring than the number of operations it must perform. As shown in Figure 9, the repair mechanism randomly exchanges one of the remaining operations for a missing one. Step 8. The algorithm returns to Step after creating offspring alpha from the crossover and mutation operations to generate the respective beta chromosome. The fitness value is calculated for each chromosome in the new generation using Step 4. Step 9. After performing all the iterations N of the algorithm, the best beta chromosome with the lowest total weighted penalty is selected as the best global solution. Then, the corresponding Gantt chart is created to represent the production schedule. In summary, the basic structure of the proposed GA for the FJSSP is presented below in the Algorithm 1 through its pseudo-code. Figure 6:0 Mutation operator based on SWAP movements. Figure 6:1 Repair mechanism.