### Appendix A.3  
Pseudocode with Local Search heuristic. ``` Input:\(route\),\(idxs\),\(cap\),\(d_{i}\),\(C_{i}j\) Output:\(Routes_{cd}\),\(Routes_{s}\) best = route.copy() bestidsxs = idxs.copy() improved = True while\(improved\)do improved = False idxi = 0 \(node_{start}^{Route}\) = 0 \(node_{end}^{Route}\) = \(bestidsx[idx]\) \(node_{end}^{nextRoute}\) = \(bestidsx[idxi+1]\) if idxi + 1 < Size(\(bestidsx\)) else\(node_{end}^{Route}\) for\(i\to 1\)to Size(\(route\)) - 2 do if\(i>node_{end}^{Route}\)then idx = idxi + 1 \(node_{start}^{Route}\) = \(node_{end}^{Route}\) = \(bestidsx\)[idxi] \(node_{end}^{nextRoute}\) = \(bestidsx\)[idxi + 1] if idxi + 1 < Size(\(bestidsx\)) else\(node_{end}^{Route}\) else end for for\(j\to i\)+1 to\(node_{end}^{nextRoute}\) - 1 do if\(j\) - \(i\) = 1 then continue // skip, no change else \(route^{new}\) = route.copy() // / Creates a copy of route \(route^{new}\)[i:] = \(route[j-1:i-1:-1]\) // 2-opst swap // Check capacity constraints: \(l\) = -1 if\(j\)\(node_{end}^{Route}\)then // Calculate new position after inversion: \(l=i+(j-1-node_{end}^{Route})\) if\(sum(d_{i}[route^{new}[node_{start}^{Route}:_{l}+1]])>cap\) or \(sum(d_{i}[route^{new}[_{i}:node_{end}^{nextRoute}+1]])>cap\)then continue else  end if  end for M = Cost(\(route^{new}\),\(C_{ij}\)) - Cost(best,\(C_{ij}\)) if\(M<0\)then if\(l\
eq-1\)then idx[\(idx[idx]=_{l}\) \(node_{end}^{Route}=_{l}\) else end end best = \(route^{new}\).copy() bestidsxs = idxs.copy() improved = True route = best.copy() else end if if improved then break else

## References

* Statista (2024) Statista. Retail Retail e-Commerce Sales Worldwide from 2014 to 2026. Available online: [[https://bit.ly/32](https://bit.ly/32) SAtPQ]([https://bit.ly/32](https://bit.ly/32) SAtPQ) (accessed on 21 January 2024). * [PERSON] and [PERSON] (2020) [PERSON]; [PERSON] [PERSON] The value of physical distribution flexibility in serving dense and uncertain urban markets. _Transp. Res. Part A Policy Pract._**2020**, _136_, 151-177. [CrossRef]
* [PERSON] et al. (2019) [PERSON]; [PERSON] [PERSON]; [PERSON] Integrating collection-and-delivery points in the strategic design of urban last-mile e-commerce distribution networks. _Transp. Res. Part E Logist. Transp. Rev._**2019**, _131_, 37-67. [CrossRef]
* [PERSON] et al. (2008) [PERSON]; [PERSON]; [PERSON] [PERSON]; [PERSON] _Clustering-Based Heuristics for the Two-Echelon Vehicle Routing Problem_; CIRRELT: Montreal, QC, Canada, 2008. * [PERSON] et al. (2016) [PERSON]; [PERSON]; [PERSON] Intermediate facilities in freight transportation planning: A survey. _Transp. Sci._**2016**, _50_, 763-789. [CrossRef]
* [PERSON] et al. (2019) [PERSON]; [PERSON]; [PERSON]; [PERSON] The two-echelon capacitated electric vehicle routing problem with battery swapping stations: Formulation and efficient methodology. _Eur. J. Oper. Res._**2019**, _272_, 879-904. [CrossRef]
* [PERSON] and [PERSON] (2018) [PERSON]; [PERSON] A decision support system for optimizing the last-mile by mixing traditional and green logistics. In _Lecture Notes in Business Information Processing_; Springer International Publishing: Cham, Switzerland, 2018; pp. 28-46. * [PERSON] (2018) [PERSON] Decision support systems for a sustainable management of the indoor and built environment. _Indoor Built Environ._**2018**, _27_, 1303-1306. [CrossRef]
* [PERSON] et al. (2023) [PERSON]; [PERSON]; [PERSON] [PERSON] A Multithreaded Algorithm for the Computation of Sample Entropy. _Algorithms_**2023**, _16_, 299. [CrossRef]
* [PERSON] (2014) [PERSON] _Visualization Analysis and Design_; [PERSON]/CRC Press: Natick, MA, USA, 2014. [CrossRef]
* [PERSON] et al. (2013) [PERSON]; [PERSON]; [PERSON] A branch-and-cut algorithm for the symmetric two-echelon capacitated vehicle routing problem. _Transp. Sci._**2013**, _47_, 23-37. Available online: [[http://www.jstor.org/stable/23362884](http://www.jstor.org/stable/23362884)]([http://www.jstor.org/stable/23362884](http://www.jstor.org/stable/23362884)) (accessed on 18 October 2023). [CrossRef]
* [PERSON] et al.