## 4 Genetic Algorithm
### Solution Decoding
#### 4.3.2 Assignment, Sequencing, and Completion Time  
Stage-1  
In Stage-1 of the genetic search, the assignment and sequencing of the operations and the determination of their starting and finish times are obtained using a procedure that utilizes the information in the first form of Segment-2 of the solution representation (Figure 1c). In describing this procedure, let us first define Gene5 ZF1[\(I\)] to denote the content of a gene \([j,s,o]\) in the first form of Segment-2 at location \(l\), where \(l\) runs from 1 to the total number of genes in this segment. Moreover, let us define \(r_{m}\) as a run counter for machine \(m\), which increases by one every time an operation is assigned to the machine.  
With this definition, the steps for the determination of the assignment and sequencing of operations in Stage-1 of the search are outlined in Figure 2 along with the procedure described in Figure 3 to evaluate the decision variables \(c_{o,s,j,m}\), \(l_{m,o,s,j}\), \(e_{s,j}\), and \(d_{s,j}\). In Step-1, the counters \(l\) and \(r_{m}\) are initialized to 1 and 0, respectively. The values of the indices \(j\), \(s\), and \(o\) are obtained from Gene5 ZF1[\(I\)] at Step-2. In Step-3, if \(b_{s,j}\) is zero, the algorithm moves to Step-9. Otherwise, it advances to Step-4. In these steps, the counter \(r_{m}\) is temporarily increased by 1 corresponding to all the eligible machines for operation \(o\) of job \(j\). Then, using the procedure outlined in Figure 3, the variables \(c_{o,s,j,m}\), \(l_{m,o,s,j}\), \(e_{s,j}\), and \(d_{s,j}\) are evaluated corresponding to all these eligible machines.  
In Step-5, the machine that finishes operation \([o,s,j]\) with the smallest \(c_{o,s,j,m}\) is selected, and in Step-6, the operation is assigned to the \(r_{m}^{th}\) run of this machine. In Step-7, the values of the decision variable calculated corresponding to the selected machine are retained as final values. The values of the counter \(r_{m}\), that was temporarily increased in Step-4, are reduced by 1 corresponding to those machines that are not selected to process operation \([o,s,j]\). In Step-9, the algorithm stops if all the operations are assigned, or otherwise, it increases the counter \(l\) by one and then returns to Step-2.  
Stage-2  
In Stage-2 of the genetic search, the second form of Segment-2 of the solution representation (Figure 1d) is used. This form of the segment explicitly encodes the assignment and sequencing of the operations as it was discussed in Section 4.2. Unlike the decoding procedure previously discussed for Stage-1, the decoding in Stage-2 does not follow a greedy approach in selecting a machine for an operation assignment as the assignment and sequencing are directly inferred from the solution representation.  
The decoding procedure is only for the determination of several continuous variables along with the start and finish times of the operations of all the sublots with non-zero sizes. This decoding procedure is outlined in Figure 4. In this decoding procedure, the notation GeneS2F2\([l]\) denotes the content of the gene \([j,s,o,m]\) at location \(l\) of the second form of Segment-2. The notations \(l\) and \(r_{m}\) have the same meaning as when they were used in the previous discussion.