## 3 IMOGWO Algorithm Design
### Basic GWO Algorithm Description
#### 3.2.1 Encoding and Decoding  
Since the basic GWO algorithm is used to solve the continuous function optimization problem, the random key coding rule [32] based on ascending order is used to encode the jobs, which forms a one-to-one mapping of the individual position and the job processing order, in order to construct a one-dimensional chromosome encoding scheme. This method does not require excessive memorysettings, but the assignment information of the jobs in the factories is not shown. In this paper, the transformation of chromosome from one dimension to two dimensions is realized by decoding the operation. The newly added one-dimensional chromosome is used to store the information that shows which factory the jobs are assigned to, and it occurs only during the manufacturing process, which is called the invisible chromosome in this paper. The decoding operation is divided into two phases. The first phase realizes the assignment of jobs to each processing factory. The second phase realizes the scheduling and corresponding machine allocation of assigned jobs in each factory. In the first phase, the heuristic rule DR is designed to decode, which considers processing time of jobs and factory load. In the second phase, the PS decoding method in literature [33] is used. In order to clearly describe the two-stage decoding method, this paper gives a detailed description of it through a small-scale test case of semiconductor wafer fabrication with four jobs, three stages, and two re-entries. In this example, two processing factories are set up, each of which has three stages. The number of parallel machines at the same speed in the first factory is shown in References [1,2,2]. The processing power of one machine at the first stage is 7 kw/h and the idle power is 1 kw/h. The processing power of two machines at the second stage is 5 kw/h and the idle power is 2 kw/h. The processing power of two machines at the third stage is 8 kw/h and the idle power is 2 kw/h. The effective service time of lubricants on the machines of the same stage is equal, in order of [5.7,5.9,4.4] (unit: h). The amount of lubricants used on the machines of the same stage is equal, in order of [0.25, 0.27, 0.25] (unit: L). The number of parallel machines at the same speed in the second factory is [2,1,2]. The processing power of two machines at the first stage is 8 kw/h and the idle power is 5 kw/h. The processing power of one machine at the second stage is 5 kw/h and the idle power is 3 kw/h. The processing power of two machines at the third stage is 6 kw/h and the idle power is 1 kw/h. The effective service time of lubricants on the machines of the same stage is equal, in order of [5.5, 5.1, 4.1] (unit: h). The amount of lubricants used on the machines of the same stage is equal, in order of [0.28, 0.22, 0.31] (unit: L). The carbon emissions factor of electric energy is 0.6747 kgCO\({}_{2}\)/kw\(\cdot\)h, and the carbon emissions factor of lubricants is 2.85 kgCO\({}_{2}\)/L [34]. The processing time and delivery time of each job at each stage (unit: min) are shown in Table 3. The data outside the brackets is the processing time and delivery time of jobs processed in factory 1. The data inside the brackets is the processing time. The delivery time of the jobs processed in factory 2. [1, 3, 2, 4] represents the encoding scheme of jobs in this example. The decoding operation is first performed on job 1, and then job 3, 2, and 4 are sequentially performed. The heuristic rule DR (Dynamic Rules) determines the strategy for allocation of jobs to the factories. The specific steps are as follows:  
1. for each job, select a factory with less average processing time to process it. If there are multiple choices, go to Step 2. 2. compare the number of jobs that have been allocated to the two factories, and select the factory with fewer jobs allocated for processing the job. If there are multiple choices, go to Step 3. 3. compare the total number of machines in the two factories.