# An Improved Spider Wasp Optimizer for Green Vehicle Route Planning in Flower Collection
## 4 Algorithm Design
### Local Search Based on Six Neighborhood Search Operators in Discrete SWO
#### 4.8.1 The Discretized SWO Search Phase  
When the distance between two customers is short but their time windows differ significantly, serving them consecutively with the same vehicle may lead to increased waiting time. Conversely, if two customers have similar time windows but are geographically far apart, assigning them to the same vehicle may violate the hard time window constraint. Therefore, both temporal and spatial factors should be considered when designing the neighborhood search operator. Additionally, chromosomes with higher fitness values typically contain gene segments similar to those in the optimal solution. Preserving these high-quality gene segments and passing them to the next generation helps propagate superior genes throughout the population, accelerating the algorithm's convergence.  
1. Damage Repair Operators Based on Frequency of Occurrence and Connectivity Probability(DRO_FC): The top 10% of chromosomes with the highest fitness in the population are selected to form the elite population. The most frequently occurring customers at each position within the chromosomes of the elite population are then counted to construct temporary routes. Customers matching the temporary routes are retained, while the remaining ones are removed. The connection probability between nodes is calculated using the spatio-temporal distance matrix [34] and common information from the elite population. This probability represents the likelihood that two nodes will be visited consecutively by the same vehicle. Deleted customers are then reinserted into the route based on this probability; in this case, a higher connection probability indicates a lower incremental routing cost when reinserting the node. Based on the spatial-temporal distance matrix and the common information of the elite population, the connection probability between nodes \(i\) and \(j\) can be computed using the following formula: \[IM=\alpha_{1}\times\left(TS_{\text{max}}-TS_{ij}\right)+\left(1-\alpha_{1} \right)\times\frac{\left(FN_{ij}-FN_{\text{min}}\right)}{\left(FN_{\text{max }}-FN_{\text{min}}\right)}\] (17) where \(\alpha_{1}\) is the weighting factor in the formula that regulates the balance between spatial-temporal distance and adjacency information of nodes within the elite population. \(TS_{i,j}\) denotes the spatial-temporal distance between nodes \(i\) and \(j\), while \(FN_{i,j}\) denotes the total number of times nodes \(i\) and \(j\) are adjacent in the elite population. The spatial-temporal distance between nodes \(i\) and \(j\) is determined by the following formula. \[TS=\alpha_{2}\times\frac{\left(d_{ij}-d_{\text{min}}\right)}{\left(d_{\text{ max}}-d_{\text{min}}\right)}+\left(1-\alpha_{2}\right)\times\frac{\left(TD_{ij}-TD_{ \text{min}}\right)}{\left(TD_{\text{max}}-TD_{\text{min}}\right)}\] (18) \(\alpha_{2}\) denotes the weighting factor that balances spatial and temporal distances. \(TD_{ij}\) denotes the time distance between customers \(i\) and \(j\).
2. Damage Repair Operators Based on Common Subsequence and Connectivity Probability(DRO_CC): The longest common subsequence [35] with the elite individual is retained, and the remaining customers are subsequently removed. The connection probability between each customer is then calculated using the aforementionedEquations (17) and (18), and the removed customers are reinserted into the route based on their connection probabilities.