# Optimizing Electric Vehicle Routing Efficiency Using K-Means Clustering and Genetic Algorithms
## 5 Results  
EV route planning is essential for minimizing travel time and optimizing energy consumption, especially in scenarios where multiple charging stations are present. The problem addressed in this work is highly complex, with an extensive search space for possible solutions. Using the proposed approach, solutions can be rapidly simulated with minimal computational resources. In this section, a visual representation of the case study under examination is presented. Figure 12 presents a detailed visualization of an EV's route across multiple charging stations on a two-dimensional plane, showcasing the algorithm's dynamic decision-making process. An information bar at the top displays key parameters of the genetic algorithm used for route computation, including EV capacity (100), population size (1000), generations (100), mutation probability (1%), number of charging stations (150), average queueing time (12 min), and max stagnation (20 generations).  
The points on the figure denote charging stations, with colors indicating queueing times. Stations within the EV's current cluster are color-coded according to actual queueing times, as represented by the color bar on the right, where green shades signify shorter waits and red shades denote longer ones. For stations outside the EV's current cluster and at greater distances, a uniform color reflects the average queueing time, accounting for the uncertainty in accurately predicting conditions at these farther locations.  
Figure 11: Dynamic elitism.  
In the figure, the charging stations selected for the EV to stop and recharge are identified with numbered boxes (stations 23, 43, 72, 103, and 123). The algorithm updates the route iteratively, and the selections may change as iterations are performed. By visualizing these choices, the figure emphasizes the importance of balancing accurate, real-time data  
Figure 12: Stations generated along the first sections of the path.  
with estimated values to optimize decision-making. Together, this visualization provides valuable insights into how the algorithm manages real-time data, uncertainties, and optimization to generate efficient EV routes. The initial state of the system is illustrated in Figure 12a. We identified the optimal charging stations for this scenario, taking into consideration that charging times are only known within the cluster in which it is currently located. This can be observed by examining all points that are not yellow.  
After the EV completes the first segment of the route, charging stations from the previous section are dynamically updated, specifically Charging Station 3. Instead, dynamic adjustments in the route optimization process identified Charging Station 7, located further along the route, as the nearest and most suitable charging station. In the updated route, as depicted in Figure 12b, the algorithm dynamically bypasses Charging Station 7 and selects Charging Station 22, situated farther from the starting point. This adjustment is likely made to optimize the overall travel distance.  
In Figure 12c, it can be seen that the optimal route has changed, and the driver now needs to stop at station 31, which is linked to point 5 on the route. Both stations, station 31, which is now selected, and station 39, chosen in the previous figure (one segment earlier), belong to the same cluster. Since the waiting times at both stations are known and their efficiency (indicated by color) is nearly identical, this change is likely due to the randomness inherent in the model.