4.1.2. Decoding Rules

Herein, a hybrid schedule generation scheme (HSGS) [32] was used as the decoding rule. The earliest start time of an activity can be determined when the predecessors of the activity have been completed and resource requirements have been met. HSGS is used to determine the completion time of each activity in turn and then calculate the total duration of the entire project.

Step 1. Let *An* be the set of activities that have been scheduled, and let *Un* be the set of activities that have not been scheduled. When initialized, *An* <sup>=</sup> <sup>∅</sup> and *Un* <sup>=</sup> {1, 2, . . . , *<sup>N</sup>*}. First, the priority of each activity in *Un* is sorted in descending order, and the activity with the highest priority is selected for the arrangement.

Step 2. Continue to select the highest priority activity from *Un* and conduct a timing constraint judgment. If satisfied, proceed to the next step. If not, the next activity is selected for judgment until the activity that meets the conditions is determined.

Step 3. Conduct resource constraint judgment on the activity to determine whether it can be scheduled in parallel with scheduled activities. If so, proceed to the next step and arrange the activity into *An*; if not, go to Step 2.

Step 4. Update *An* and *Un*, then repeat from Step 1 until all activities are scheduled, i.e., *An* <sup>=</sup> {1, 2, . . . , *<sup>N</sup>*} and *Un* <sup>=</sup> <sup>∅</sup>.

#### 4.1.3. Fitness Function

Because there are two objective functions of duration and cost in the upper planning, the fitness function is constructed using the weighted aggregation method, to maintain the effectiveness of the multiple objectives. Let *μ*<sup>1</sup> and *μ*<sup>2</sup> represent the weights of the two

objective functions; the fitness function can then be represented by Equation (23). After making the changes, the maximum fitness value is required.

$$Fitness(F) = \mu\_1 \frac{F\_t^{\text{max}} - F\_t}{F\_t^{\text{max}} - F\_t^{\text{min}}} + \mu\_2 \frac{F\_c^{\text{max}} - F\_c}{F\_c^{\text{max}} - F\_c^{\text{min}}} \tag{2.3}$$

4.1.4. Genetic Manipulation

Step 1. Set the parameters in the GADS: size *L*1, maximum number of iterations *T*1, crossover probability *pc*, and mutation probability *pm*.

Step 2. Initialize *L*<sup>1</sup> individuals as a group, set the initial iteration *τ*<sup>1</sup> = 0, and use the coding program to generate the initial individuals *Sl*(0).

Step 3. Through the elite roulette method to select individuals, according to the size of fitness, develop roulette with slots, and use the roulette to generate the next generation of individuals (*τ*<sup>1</sup> + 1). If the fitness function of the *l* chromosome in the population is *f*(*Sl*), then the probability of chromosome *Sl* being selected is

$$P\_l = \frac{f(S\_l)}{\sum\_{l=1}^{n} f(S\_l)}\tag{24}$$

Step 4. Since the chromosome of the algorithm consists of an activity list and a mode list, it is necessary to cross these two lists in steps.

Step 4.1. The activity list is crossed using the alternating crossing method. First, the first gene from parent A is added to offspring A. Then, we select the first gene from parent B and judge whether it is duplicated with genes in offspring A. If it is duplicated or does not conform to the hierarchical order, it is discarded; if it is not repeated but conforms to the hierarchical order, it is added to offspring A.

Step 4.2. The second gene is selected from parent A to judge whether it is duplicated. Finally, the genes in the two parents are selected in turn to form offspring A. Similarly, the genes in parents B and A are selected to obtain child B.

Step 4.3. Then, the mode list was crossed by a single-point operation. Let *i* be the position of the gene, let *N* be the total length of the chromosome, and randomly select integer *n*<sup>1</sup> < *N*. If 1 ≤ *i* ≤ *n*1, then the mode of gene *i* of offspring A is equal to that of parent A; if *n*<sup>1</sup> ≤ *i* ≤ *N*, then the mode of child A is equal to that of parent B.

Step 4.4. Similarly, randomly select integer *n*<sup>2</sup> < *N*. If 1 ≤ *i* ≤ *n*2, then the mode of gene *i* of offspring B is equal to that of parent A; if *n*<sup>2</sup> ≤ *i* ≤ *N*, then the mode of child B is equal to that of parent B.

Assuming that *n*<sup>1</sup> = 4, *n*<sup>2</sup> = 5, a schematic diagram of the chromosome crossover operation is shown in Figure 2.

**Figure 2.** Schematic diagram of crossover operation.

Step 5. This step is concerned with mutation. For the variation of the activity list, on the premise of satisfying the hierarchy order, the mutation operation is carried out by the exchange mutation method, in which two mutation points are randomly selected from parents and genes are swapped at those two locations. However, activity modes do not change, as demonstrated in Figure 3. In Figure 3, activities 6 and 8 in level 3 are exchanged and mutated to obtain new individuals. For the variation in the mode list, an activity is randomly selected, and its activity mode is changed, as demonstrated in Figure 3.


**Figure 3.** Variation operation diagram.

Step 6. Let the number of iterations be *τ*<sup>1</sup> = *τ*<sup>1</sup> + 1 and enter the next round of iterations until the maximum is reached.
