## 3 Proposed Methodology
### Decoding the Customer Vector  
The customer vectors in the particles presented in the previous section are in an encoded form. It is not only difficult to comprehend them but also not suitable to apply the proposed local search operations on them. We propose a novel distance-based decoding method presented in Algorithm 1 to make a complete CVRP solution from a chromosome or customer vector. In the proposed decoding method, the required number of vehicles \(m\) is taken as input parameter from the problem statement. We first assign the first \(m\) customers in the customer vector to the \(m\) vehicles (line 2 to line 4 in Algorithm 1). Afterwards we assign each of the remaining (\(n-m\)) customers to one of the \(m\) routes according to Algorithm 1. For a customer \(c^{i}\), where \(m<i<n\), we first try to add it to the end of a suitable route (line 9 to line 16 in Algorithm 1). For this, we rank the routes according the distances of their last assigned nodes from \(c^{i}\), and try to assign it to the end of the route having \(c^{i}\)'s closest possible customer at its end. According to the rank, we keep on trying the routes one after another to find a suitable route where \(c^{i}\) can be assigned without exceeding the corresponding vehicle's capacity. If \(c^{i}\) cannot be assigned to any route following this strategy, i.e., its addition to any route exceeds the limit of the vehicle, we try to replace a customer having a lower demand than \(c^{i}\). This procedure is depicted from line 17 to 31 in Algorithm 1. An example scenario presents the major steps of the mechanism of Algorithm 1 followed by the pseudocode. ```


Suppose a CVRP example problem scenario with 11 nodes as given in Table 2.

Note that a random customer vector (2, 8, 6, 9, 11, 7, 3, 4, 5, 10) is found in an iteration of PSO. Considering the vehicle capacity constraint to be 40, the number of vehicles required is assumed to be given as 4. Now the first 4 customer nodes from the customer vector will be assigned to the 4 routes, say, R1 = (2), R2 = (8), R3 = (6) and R4 = (9). Afterwards the algorithm will try to insert node 11 to any of the routes. For this, the routes are sorted in non-increasing order based on distances of node 11 from their last nodes, e.g., 2, 8, 6 and 9. Suppose the sorted sequence is (R4, R2, R1, R3). Since adding node 11 to route 4 does not violate the capacity constraint, R4 becomes (9, 11). The next node in the customer vector is node 7, for which suppose that sorted route sequence is (R1, R2, R3, R4). R1 can successfully accommodate node 7, and it becomes (2, 7). Following this manner, suppose that nodes 3 and 4 are assigned to R2 and R3, making them (8, 3) and (6, 4), respectively. Now based on node 5, suppose that the sorted route sequence is (R2, R1, R3, R4). However, note that adding node 5 exceeds the vehicle capacity for each of the routes. So, it cannot be assigned in this step. Now according to the second strategy, the algorithm tries to the replace a node with 5 from any of the routes. For this the routes are again sorted in non-increasing order based on the increases of the distances if the nodes 7, 3, 4 and 11 are replaced by node 5. Suppose that the sorted sequence is (R4, R1, R3, R2). So, the algorithm tries R4 first, and finds that replacing node 11 with node 5 does not violate the capacity constraint. Hence, R4 becomes (9, 5), and node 11 is added to the end of the customer vector, making a temporary customer vector as (2, 8, 6, 9, 11, 7, 3, 4, 5, 10, 11). The node 10 is then assigned to R2, making it (8, 3, 10), according to the first strategy. Now, the algorithm tries to insert node 11 again to any of the routes. According the first strategy, suppose the sorted route sequence is (R1, R4, R3, R2). Hence, node 11 can be accommodated in R1, making it (2, 7, 11). After decoding steps, now we have route vectors at hand (R1 (2, 7, 11), R2 (8, 3, 10),