# Optimizing Electric Vehicle Routing Efficiency Using K-Means Clustering and Genetic Algorithms
## 4 Hyper-Parameters Optimization  
To assess the performance of the proposed dynamic electric vehicle routing problem, several case studies were conducted using simulated datasets. Based on the datasets, EVs were required to choose the best routes, taking into account both travel distance and charging station waiting times. The hyper-parameter optimization process effectively reduces the overall travel time and minimizes waiting periods at charging stations, leading to more efficient and reliable EV journeys [39]. By dynamically adjusting routes based on real-time data, it enhances the adaptability of EVs to fluctuating conditions, ensuring that drivers experience fewer delays and improved energy management.  
The following hyper-parameters were examined in the case studies:  
* Datasets: A total of 150, 300, and 500 charging stations were randomly placed on routes.  
* Queuing times: For each experiment, queueing times at charging stations were simulated using a random value generator, constrained between a minimum and maximum waiting time (set to 0 and 20 min, respectively). Modeled waiting times at charging stations were determined by EV charging rates, station capacities, and charging speeds.
* Real world dynamics: Charging stations are often limited, and queueing times vary.  
The GA parameters are as follows: Population sizes of 200, 500, 1000, and 2000 were tested over 100 generations with a mutation probability of 1 (adjusted in some experiments), an EV capacity of 100, and a max stagnation limit of 20 to optimize routes through crossover, mutation, and selection. Various selection, mutation, and crossover strategies are assessed for their impact on the performance of GA for optimizing EV routing. In addition, we examined ways to improve the computational efficiency of the algorithm.  
Three selection methods were assessed as follows:  
* Tournament selection: This method organizes competitions among a subset of individuals, selecting the fittest to join the mating pool. Larger tournament sizes increase selection pressure, favoring high-quality individuals but requiring careful balancing to avoid premature or slow convergence.
* Roulette wheel selection: Chromosomes are selected based on fitness proportions, akin to a roulette wheel where fitter individuals occupy larger segments, increasing their chances of selection.
* Rank selection: To address disparities in fitness, this method ranks individuals and assigns probabilities based on their rank rather than fitness, ensuring all chromosomes have a chance for selection but potentially leading to slower convergence.  
Parent selection methods  
Figure 6 illustrates that tournament selection consistently outperforms both roulette wheel and rank selection across varying population sizes and numbers of charging station points. Tournament selection, utilizing competition within smaller subsets of the population, demonstrated superior performance, particularly with smaller tournament sizes, \(K=4\). In comparison, the roulette wheel and rank selection methods exhibited lower fitness scores, especially in more complex scenarios involving a higher number of charging station points (300 points). This indicates the diminished ability of these methods to effectively explore and exploit the solution space as problem complexity increases. In smaller scenarios (150 points), differences between the methods were minimal, although tournament selection maintained a slight advantage in smaller populations. However, as complexity increased, tournament selection \(K=4\) exhibited clear superiority and greater stability across most population sizes, highlighting its robustness in addressing complex optimization problems.  
Figure 6: Selection comparison.