## 3 Materials and Methods
### Proposed Adaptive Large Neighborhood Search
#### 3.2.1 Initial Solution  
The proposed heuristic for minimizing customer tardiness in the initial solution starts by creating the number of routes obtained by dividing the total customer demand by the vehicle load capacity. All customers are assigned to each route by sorting them according to their latest start time to service value. Customers assigned to routes are added as long as they do not exceed the vehicle capacity. The pseudocode of the initial solution is given in Algorithm 2. ```
Input:\(\text{customer\_list}\) Sort all customers by their \(\text{due\_date}\) in ascending order Calculate the \(total\_demand\) of customers \(num\_routes\leftarrow[\,\,\,[total\_demand/vehicle\_capacity]\



#### 3.2.2 Neighborhood Solutions

ALNS creates new solutions by destroying a solution and repairing it again. It selects and applies an operator from the \(\Omega^{-}\) removal operator set at each step. This causes the structures on the route to be removed from the solution. Then, with the operator selected from the \(\Omega^{+}\) insertion operator set, it inserts the removed structures back into the routes with specific approaches. Thus, a new solution is obtained, and neighboring solutions are discovered. The selection of an operator \(i\) depends on the probability \(w(i)/\sum_{i^{\prime}\in\Omega_{i^{\prime},-}}w(i^{{}^{\prime}})\). This probability is calculated depending on each operator's weight \((w)\). Initially, the weights of all operator groups are equal; \(\frac{1}{\Omega_{+}}\) gives the weight of insertion, and \(\frac{1}{\Omega_{-}}\) gives the weight of the removal operators. Roulette wheel selection is used to select the operators. Within the operator group, the weight of each operator is calculated, and the probability of using the operator with the higher weight increases. This increase is calculated according to the state of the newly obtained solution \(S^{new}\), as given in Equation (7). \[\pi_{1}=\left\{ \begin{array}{ll}\pi_{1},&\quad\text{if }S^{\text{new}}<S^{\text{ best}}\\ \pi_{2},&\quad\text{if }S^{\text{best}}<S^{\text{new}}<S^{\text{current}}\\ \pi_{3},&\quad\text{if }S^{\text{new}}>S^{\text{current}}\\ 0\,,&\quad\text{if }S^{\text{new}}=\varnothing\end{array} \right. \tag{7}\]

\(\pi_{1}\), \(\pi_{2}\), and \(\pi_{3}\) are obtained based on how good the new solution is. The score is \(\pi_{1}\) if the applied values are the operators that led to the best solution, \(\pi_{2}\) if they improved the existing solution, \(\pi_{3}\) if it is an acceptable solution, and zero if no solution was found. At iteration step \(Z\) at the specified iteration lifting frequency, the operator weights are updated with Equation (8). \[\text{w}\big{(}i^{\prime}\big{)}=\left\{ \begin{array}{ll}(1-\text{r})\cdot \text{w}(i)+\text{r}\cdot\pi_{i}/\text{Q}_{i}\,&\quad\text{if }\text{Q}_{i}>0\\ (1-\text{r})\cdot\text{w}(i)&\quad\text{,}\quad\text{if }\text{Q}_{i}=0\end{array} \right. \tag{8}\]

When updating the weight, the previous weight value \(w(i)\), the number of times operator \(i\) is used \(Q_{i}\), and the total score of operator \(i\) are used. \(r\) is a parameter in the interval (0, 1) and determines whether the score or the old value dominates when determining the new value. #### 3.2.3 Removal Operators

Removal operators are important for obtaining different neighborhoods. Examining the existing structures in the routes breaks the solution in certain situations and provides the opportunity to create better routes. This study uses three groups of removal operators: customer, charging station, and route. **Customer Operators:** Customer removal operators aim to remove customers from the route. When the operators are applied, the customers removed from the solution are added to the unserved customer list and removed from the served customer list. When the operators are applied, the number of customers to be removed \((P)\) is set as \(min([0.4 TC,\ 60])\) of the total number of customers \((TC)\)[21].