## 5 Resolution Methods
### Genetic Algorithm
#### 5.1.3 Fitness Evaluation  
Algorithm 1 decodes the chromosomes to obtain the objective function value and a workable representation of the solutions.  
```
* Step 01: Set \(p=1\).
* Step 02: Set \(i,l,j,k\), the index values of the gene located at the \(P\) position of the chromosome.
* Step 03: Calculate the completion time \(C_{iljk}\).
* If operation \(j\) of sub-lot \(l\) of job \(i\) is the first operation assigned to the machine \(k\) and \(j=1\), \[S_{iljk}=A_{k}+T_{k};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If operation \(j\) of sub-lot \(l\) of job \(i\) is the first operation assigned to the machine \(k\), \(j>1\), and the operation \(j-1\) is assigned to the machine \(k^{\prime}\), \[S_{iljk}=Max\{A_{k}+T_{k},C_{ilj-1k^{\prime}}\};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If operation \(j^{\prime}\) of sub-lot \(l^{\prime}\) of job \(i^{\prime}\) is the operation to be processed immediately before the operation \(j\) of sub-lot \(l\) of job \(i\) on the machine \(k\) and \(j=1\), \[S_{iljk}=s_{i^{\prime}j^{\prime}jk}+C_{i^{\prime}l^{\prime}jk};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If operation \(j\) of sub-lot \(l\) of job \(i\) and the operation \(j\) of sub-lot \(l^{\prime}\) of job \(i\) are assigned to the machine \(k\) and \(j=1\),
* If (\(k\in M_{2}\cup M_{3}\) and \(2*q_{i}<=R_{k}\)) \[S_{iljk}=S_{iljk};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If (\(k\in M_{2}\cup M_{3}\) et \(2*q_{i}>R_{k}\)) ou (\(k\in M_{1}\)) \[S_{iljk}=F_{il^{\prime}jk};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{ iljk}\}\]
* If operation \(j^{\prime}\) of sub-lot \(l^{\prime}\) of job \(i^{\prime}\) is the operation to be processed immediately before the operation \(j\) of sub-lot \(l\) of job \(i\) on the machine \(k\), \(j>1\), and the operation \(j-1\) is assigned to the machine \(k^{\prime}\), \[S_{iljk}=Max\{s_{i^{\prime}j^{\prime}jk}+C_{i^{\prime}l^{\prime}jk},C_{ilj-1k^ {\prime}}\};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If operation \(j\) of sub-lot \(l\) of job \(i\) and the operation \(j\) of sub-lot \(l^{\prime}\) of job \(i\) are assigned to the machine \(k\), \(j>1\), and the operation \(j-1\) is assigned to the machine \(k^{\prime}\), \[S_{iljk}=Max\{s_{i^{\prime}j^{\prime}jk}+C_{i^{\prime}l^{\prime}jk},C_{ilj-1k^ {\prime}}\};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* If (\(k\in M_{2}\cup M_{3}\) and \(2*q_{i}>R_{k}\)) or (\(k\in M_{1}\)) \[S_{iljk}=Max\{C_{il^{\prime}jk},C_{ilj-1k^{\prime}}\};\ \ C_{iljk}=S_{iljk}+P_{ijk};\ \ C_{i}=Max\{C_{i},C_{iljk}\}\]
* **Step 04:*
* If \(p\) is less than the total number of operations of sub-lots of jobs, increment its value by 1 and go to Step 2; otherwise, go to Step 05.
* **Step 05:*
* Calculate the fitness function of the solution by using the equation \(\sum_{i}C_{i}\).
```  
**Algorithm 1**Evaluation steps of the fitness function of a chromosome  
It is worth noting that for a given \(i\) and \(l\), the gene \((i,l,j,k)\) is always located on the right of all the other genes \((i,l,j^{\prime},k^{\prime})\) with \(j^{\prime}<j\). Based on this property, when the completion time of operation \((i,l,j,k)\) on machine \(k\) is to be calculated, the completion timeof operation \((i,l,j-1,k^{\prime})\) is already calculated and available, regardless of the machine to which this preceding operation is assigned. Moreover, the completion time of the operation \((i^{\prime},l^{\prime},j^{\prime},k)\) to be processed on machine \(k\) immediately before operation \((i,l,j,k)\) is also calculated and available.  
Genetic operators evolve the population to promising regions of the research space. The convergence behavior of the algorithm depends largely on them. These operators are generally categorized as selection, crossover, and mutation operators.