# Linear Project-Scheduling Optimization Considering a Reverse Construction Scenario
## 4 Design of a Solving Algorithm for the LSM-CBPS Model
### Improved Grey Wolf Optimization Algorithm Design  
In this study, the algorithm was designed based on the framework of GWO, and the solution of the LSM-CBPS model was obtained. The original GWO was enhanced in the following three aspects. (1) Discretization: The original GWO was designed for continuous optimization problems; however, the model contains discrete variables. To make the algorithm applicable to the model, a discretization strategy was applied. Therefore, in the improved GWO algorithm, a discrete position update operator was proposed to update the positions of the individual;  
(2) Constraint handling: The GWO itself does not inherently handle constraints. Given the presence of multiple complex constraints in the proposed model, directly using the GWO may not yield satisfactory solutions. Therefore, a dynamic constraint handling mechanism and heuristic rules tailored to the optimization problem characteristics were introduced. These enhancements aimed to improve the algorithm's capability to handle constrained optimization problems;  
(3) Search ability improvement: GWO is prone to getting trapped in local optima and may have low solution accuracy. To address these issues, additional improvement strategies were incorporated. In particular, a cross-mutation strategy was introduced to enhance both the global and local search abilities of GWO. The pseudo-code for the improvement GWO is depicted in Algorithm 1. The algorithm design includes seven components: coding rules, population initialization method, decoding rules, discrete position update operators, dynamic constraint handling methods, cross-mutation strategies, and heuristic rules. ```
Input: number of activity \(N\), construction mode modes, construction direction \(dir_{i,k}\), construction crew \(crews_{i}\), population size \(npop\), maximum number of iterations \(itr_{max}\), and distance control parameter \(a\). Output: project schedule. ```  
**Algorithm 1. Pseudo-code of improved GWO. **  
```
Input: number of activity \(N\), construction mode modes, construction direction \(dir_{i,k}\), construction crew \(crews_{i}\), population



#### 4.2.1 Encoding Mode

The scheduling optimization model involves four decision variables. To represent these variables, a four-layer coding rule was constructed, as illustrated in Figure 7.

1. The first layer represents the selected construction crew for each section. When \(cr_{i,k}=c\), it indicates that the construction crew selected for the subactivity of activity \(i\) on the \(k\)th section is \(c\). Subactivities that share the same construction crew \(c\) constitute set \(seq_{i,c}\) of the construction crew \(c\). All selected crews for activity \(i\) constitute set \(scr_{i}\);
2. The second layer represents the start time of each crew. When \(ct_{i,c}=t\), the construction start time for the \(c\)th crew of activity \(i\) is \(t\);
3. The third layer represents the construction direction for each crew. When \(cd_{i,c}=1\), the construction direction for the \(c\)th crew of activity \(i\) is positive. When \(cd_{i,c}=0\), the direction is reversed;
4. The fourth layer represents the construction mode for each crew. When \(cm_{i,c}=h\), the construction mode chosen by the \(c\)th construction crew representing activity \(i\) is \(h\). #### 4.2.2 Population Initialization

Once the encoding mode of the grey wolf location information is determined, the next step is generating the initial population. To simplify the process of generating feasible solutions and enhance the efficiency of the algorithm, the crew, mode, and construction direction were randomly initialized. The start time of the construction crew was determined using heuristic rules, as described in Section 4.2.7. #### 4.2.3 Decode

After obtaining the population information of each generation, the grey wolf location information must be decoded and mapped onto a schedule to calculate the objective function value and constraint violation value, followed by population assessment and updating.