Optimization Challenges in Vehicle-to-Grid (V2G) Systems and Artificial Intelligence Solving Methods

: Vehicle-to-grid (V2G) systems play a key role in the integration of electric vehicles (EVs) into smart grids by enabling bidirectional energy flows between EVs and the grid. Optimizing V2G operations poses significant challenges due to the dynamic nature of energy demand, grid constraints, and user preferences. This paper addresses the optimization challenges in V2G systems and explores the use of artificial intelligence (AI) methods to tackle these challenges. The paper provides a comprehensive analysis of existing work on optimization in V2G systems and identifies gaps where AI-driven algorithms, machine learning, metaheuristic extensions, and agile optimization concepts can be applied. Case studies and examples demonstrate the efficacy of AI-driven algorithms in optimizing V2G operations, leading to improved grid stability, cost optimization, and user satisfaction. Furthermore, agile optimization concepts are introduced to enhance flexibility and responsiveness in V2G optimization. The paper concludes with a discussion on the challenges and future directions for integrating AI-driven methods into V2G systems, highlighting the potential for these intelligent algorithms and methods.


Introduction
Electric vehicles (EVs) are becoming increasingly common on our roads, bringing with them the potential to revolutionize transportation and energy systems [1].In addition to being a mode of transportation, EVs can also act as mobile energy storage units, connecting to the power grid to supply electricity when needed and store excess energy when it is available.This two-way flow of energy between EVs and the grid, known as vehicle-to-grid (V2G) systems [2], holds great promise for addressing some of the key challenges facing our energy infrastructure.They can help balance the supply and demand of electricity, which is particularly important as we transition to more renewable energy sources like wind and solar power [3].By allowing EVs to discharge electricity back to the grid during times of peak demand or when renewable energy generation is low, V2G systems can help stabilize the grid and reduce the need for expensive infrastructure upgrades [4].Furthermore, V2G technology has the potential to improve the resilience and reliability of our energy systems [5].During emergencies or blackouts, EVs equipped with a V2G framework can serve as backup power to homes, businesses, and critical infrastructure, enhancing the overall resilience of existing energy infrastructure and helping communities better withstand and recover from disruptions [6].
However, realizing the full potential of V2G systems requires overcoming several optimization challenges [7].One of the key challenges is managing the dynamic nature of energy demand and supply [8].Unlike traditional power plants, which can adjust their output to match changes in demand, EVs connected to the grid have varying levels of charge and availability, which complicates the scheduling and coordination of EV battery charging and discharging to ensure optimal grid operation [9].Another challenge is optimizing the use of EV batteries while considering user preferences, grid constraints, and environmental factors [10].For example, EV owners may have specific preferences regarding when and how their vehicles are charged, such as prioritizing charging during off-peak hours or maximizing the use of renewable energy.Balancing these preferences with the need to maintain grid stability and minimize costs requires advanced optimization techniques.
In recent years, there has been growing interest in using artificial intelligence (AI) and machine learning techniques to address these challenges in V2G systems.These advanced methods can analyze large volumes of data, learn from past experiences, and adapt to changing conditions in real time, enabling more efficient and effective management of V2G operations [11].In this paper, we analyze the main optimization difficulties facing these systems and explore the potential of AI-driven solutions to overcome them.Through a review of the existing literature, case studies, and examples, we show how AI-driven algorithms, machine learning, and other advanced techniques can improve grid stability, reduce costs, and enhance the overall performance of V2G frameworks.Finally, we discuss the opportunities and future directions for integrating AI-driven optimization into these systems.The main contribution of this paper is the introduction of several novel AIbased methodologies for solving various V2G optimization problems.Key methodologies highlighted include simheuristics, learnheuristics, and agile-optimization heuristics.
The rest of the article is structured as follows: Section 2 discusses the specific challenges faced in optimizing V2G systems, including managing energy demand, ensuring grid stability, and minimizing costs.Section 3 provides a review of the existing research on optimization in this field, highlighting gaps in the current approaches and the need for more advanced techniques.Section 4 analyzes the application of AI solving methods for V2G optimization, including AI-driven algorithms, machine learning, and metaheuristic extensions.Section 5 presents case studies and examples demonstrating the effectiveness of these advanced techniques in real-world applications.Section 6 discusses the challenges and future directions for integrating AI-driven methods into V2G systems, considering the environmental, socio-economic, and policy implications.Finally, Section 7 summarizes the main conclusions of our research.

Optimization Challenges in V2G Systems
Various approaches to optimizing V2G systems have been explored.These approaches can vary significantly in terms of the optimization function used, the constraints involved-which may differ depending on the features considered-and the problem size itself.Regarding objective functions, they are diverse.However, most of them center around three main areas or a combination of them.These areas include grid load control, optimizing economic cost and minimizing pollution generation.While focusing exclusively on one of these areas is possible, authors often prefer combining objectives, either through employing a multi-objective function [12] or converting multiple objective functions into a single one [13].Additionally, in some cases, multiple objectives are correlated.For example, when considering both renewable and conventional energy generation, the cost of producing energy via sustainable sources is typically more economical than conventional energy production costs.Therefore, maximizing renewable energy generation also minimizes energy production costs.
Other variations of the problem can emerge due to the consideration of different features, which may be related to the realism or conditions of the problem itself.Realismrelated features encompass a plethora of dynamic and uncertain conditions if the problem is based on a real-life scenario.Uncertain features manifest in various ways.For instance, in a scenario where a V2G system must be implemented, uncertainty arises regarding the number of vehicles connected to the grid.EV owners may retrieve their vehicles at unknown times due to emergencies or unexpected needs, affecting the system's energy demand and charging station usage.Moreover, uncertainty surrounds the energy level at which EVs arrive at the charging stations and the variability of renewable energy generation, both of which significantly impact decision-making processes.These features pose additional challenges in providing reliable solutions, necessitating the use of robust optimization methods.Dynamic features also play a crucial role in V2G system optimization problems.These features can significantly influence system optimization and complicate the process.However, considering them is essential due to their day-to-day significance in providing realistic solutions.One essential aspect to consider is the dynamic pricing of electricity, which fluctuates throughout the day and is typically divided into three sections: valley, flat, and peak periods.These pricing segments affect EV charging strategies aimed at minimizing costs.Furthermore, electricity pricing is influenced by customer demand, presenting another challenge to the problem.Customer demand is a dynamic parameter partly determined by electricity costs as discussed in [14].

Related Work
Among the various approaches to implementing and optimizing V2G systems, evolutionary algorithms are the most widely utilized.These algorithms provide robust, nearoptimal solutions for these problems [15].However, alternative strategies such as heuristics and other metaheuristic approaches have been explored in the literature.The exploration of exact methods to tackle these problems has been studied as well.These methods employ precise algorithms to achieve optimal solutions for V2G systems.Sortomme and El-Sharkawi [16] proposed an optimal scheduling algorithm for a V2G framework, which schedules energy sales and ancillary services.This problem is formulated as a convex linear multi-objective problem and relies on real data from the Houston, Texas area.Simulations are conducted hourly over a three-month period, considering a group of 10,000 EVs, to determine the hourly optimal schedule.The simulation results show substantial financial advantages for both customers and aggregators for different battery replacement costs.Another approach is taken in the paper presented by Ahn et al. [17], where a decentralized charging algorithm for EVs is developed.Initially, the problem is optimally solved using linear programming techniques.However, due to excessive computing time requirements, a decentralized charging algorithm for load shifting is formulated.This tactic emulates the charging pattern identified through linear programming optimization solutions.The problem involves two objectives: minimizing a cost function comprising electricity generation costs and total carbon dioxide emissions, while simultaneously maximizing frequency regulation to minimize the grid's impact.Simulation studies show that the proposed algorithm not only minimizes electricity generation costs and CO 2 emissions but also effectively reduces dependence on conventional regulation power plants while maintaining optimal battery charging performance.Both papers indicate that exact methods offer optimal solutions for these problems.However, the significant computational time needed for these solutions results in the adoption of such methods being impractical for real-life applications, where time constraints are often limited.Moreover, these methods especially struggle against additional constraints resulting from uncertainty and dynamism, which can further increase the complexity of these problems or significantly worsen the solutions provided.Due to this reason, when addressing more complex problems, the use of more agile methods is required.
Evolutionary algorithms provide near-optimal solutions in a shorter computing time compared to exact methods.Additionally, because of their evolutionary component, these methods do not suffer from convergence problems.Different evolutionary algorithms have been utilized to tackle these problems.In the paper presented by Wu et al. [18], a multi-layer framework is introduced for V2G operations, where bidirectional energy transmission is considered.A particle swarm optimization (PSO) approach is employed to optimize both cost and emissions.Simulation experiments were conducted to test the variations in cost and emissions when each factor or both of them were considered in the fitness function, showcasing the significance of integrating both considerations and demonstrating that the proposed grid was feasible and effective in its purpose.Another method is utilized by Ghofrani et al. [19], who introduce a Genetic Algorithm (GA) to coordinate a V2G system.In this problem, electricity is generated in two ways: firstly, through a wind turbine, which provides non-constant and intermittent energy, and secondly through a conventional method utilized when the electricity provided by the wind turbine is insufficient to meet the demand.The objective of the problem is to minimize the conventional generation required.Various scenarios are studied to assess the ability of EVs to store wind-generated electricity, and a smart energy management system is developed, offering a more economical and efficient scheme for integrating wind resources into the generation mix.To tackle more complex problems, several authors have opted to merge different algorithms in order to provide better solutions.In the study conducted by Ghanbarzadeh et al. [20], a hybridization of the binary PSO algorithm (BPSO) and the ant colony optimization (ACO) method is proposed to optimize a implemented V2G system for the short-term unit commitment problem.To ensure reliable solutions, a reliability constraint is incorporated.The BPSO schedules the units based on logical operators, while the ACO allocates appropriate power to all committed generators.Two scenarios are considered: one with renewable sources, and another without them.Numerical results demonstrate the method's efficiency in providing near-optimal solutions.Additionally, the results indicate that as the minimum reliability level decreases, the total operation cost of the system increases.Therefore, a trade-off between the required reliability level and the total cost of the system should be considered.
Even though evolutionary algorithms provide a relatively simple and robust way to produce solutions, the use of other heuristics and metaheuristics has proved to be an excellent alternative.Thus, in the last years, authors have developed a variety of heuristic algorithms to tackle these problems.The paper by Aljanad et al. [21] presents a novel heuristic technique known as the quantum lightning search algorithm, which is an extension of the binary lightning search algorithm designed to determine the optimal placement of charging stations in a distribution network.In this study, a multi-objective function was employed, wherein the goals were to minimize line loading, voltage deviation, and circuit power loss.Computational experiments were conducted to demonstrate the effectiveness of the proposed algorithm compared to both the binary lightning search algorithm and BPSO.The results highlight its superior performance in optimizing charging station placement within the distribution network.Another example is the paper presented by Alsharif et al. [22], where a V2G framework is proposed.This problem integrates two renewable energy sources: a photovoltaic system and a wind turbine, along with a backup battery, connected to an EV charging system (EVCS).The study is based on real data and aims to study the feasibility of implementing an EVCS in the Libyan city of Tripoli.To determine the sizing of the system components, an antlion optimization algorithm is employed, subsequently validated against a PSO algorithm and a cuckoo search algorithm.The optimization results indicate that the sizing proposed meets the load demand for the on-grid system, and thus the proposed system can be effectively applied in Tripoli, especially considering its high renewable energy factors.Furthermore, the results demonstrate that the proposed method outperforms other validated algorithms.

V2G Systems Optimization under Uncertainty
As mentioned in Section 2, a variety of uncertain features are present in real-life problems.Considering these features enhances the realism of a problem while increasing its complexity.In the last years, researchers have focused on providing methods to solve problems where uncertainty is present in diverse ways.In the study conducted by Ahmadi et al. [23], a flexible multi-objective optimization approach is introduced for V2G and gridto-vehicle (G2V) technologies, taking into account environmental and economic stochastic considerations.In order to control this stochastic parameters, a Latin hypercube sampling strategy is employed.A firefly algorithm is employed to address the problem under uncertainties, resulting in significant reductions in both operating costs and CO 2 emissions, along with an improvement in the network's stability.Additionally, the performance of the algorithm is compared to that of a PSO algorithm, revealing that the proposed algorithm obtains slightly better solutions within a shorter computation time.Another method to deal with uncertainties is provided by Morshed et al. [24], who applied a probabilistic optimal power flow approach to a hybrid power system.In this system, photovoltaic, plug-in electric vehicles and wind energy sources are considered.Combining Monte Carlo Simulation with the antithetic variates method, uncertainties are accurately modeled.Subsequently, a multi-objective GA is utilized to solve the problem, and computational tests validate the effectiveness of the proposed method when compared to alternative optimization algorithms.Another way of providing high-quality solutions to problems with uncertain features is the use of fuzzy logic-based techniques.In the paper presented by Nouri et al. [11], a V2G system is implemented in a grid, where the energy is provided by a photovoltaic system, which provides uncertain intermittent energy amounts.The objective of this system is to maximize energy extraction while protecting the grid from energy oscillations and protecting the batteries from overcharging.A fuzzy logic-based charge management system is implemented to provide intelligent management of battery charge based on well-defined conditions, and a combination of an artificial neural network and a PSO algorithm is utilized to improve the performance of a V2G system.The simulation results of the proposed system in different scenarios show maximum power extraction without oscillation or overshoot, while ensuring stable energy efficiency.However, the energy efficiency value decreases when EVs do not participate in energy management, highlighting the importance of V2G operations.

V2G Systems Optimization under Dynamic Conditions
Due to the ever-changing nature of real-life scenarios, dynamic features are present in a variety of ways.While dynamic constraints increase the complexity of problems, taking them into account can greatly influence the solutions generated by the solving methods.For this reason, in recent years, authors have developed methods that generate solutions for optimization problems while dealing with the dynamic conditions they present.An example is the study conducted by ur Rehman and Riaz [25], who tackled the problem of designing a control algorithm to provide frequency regulation services and control the charge and discharge periods of EVs.The system charges the EVs while allowing these vehicles to sell back the stored energy to the grid during peak hours for frequency management.In the problem, dynamic pricing is considered, and the electricity price changes every hour.To model the price uncertainties, a Markov decision process with unidentified switching probabilities is utilized.To optimize the profit obtained by the owners, a Q-learning algorithm is implemented, which executes for each EV connected to the V2G system, considering the projected departure time and state of charge.The performance of the proposed algorithm is evaluated under different pricing scenarios, demonstrating its efficiency in increasing the profits while providing better frequency regulation services compared to those offered by conventional charging schemes.Jadoun et al. [26] discuss an optimization challenge within a V2G system, with the aim of minimizing the overall cost of micro-grid operations.This problem includes the consideration of both conventional and renewable energy generation, along with dynamic pricing to optimize energy costs for consumers.Moreover, a load variance index and a fuzzy logic-based approach are integrated to minimize operational costs without compromising micro-grid stability.To address this problem, an improved elephant herding optimization algorithm is deployed.The method's efficacy is initially tested using test functions, obtaining better solutions compared to the latest published methods.Subsequently, the method is simulated across various scenarios, demonstrating superior performance over PSO and conventional elephant herd optimization approaches.The authors conclude that allowing the free trade of power between micro-grids and the main grid could provide more economical and stable power generation processes due to the implementation of G2V and V2G operations.Table 1 summarizes the papers reviewed in this section, including their characteristics and the solution strategies taken by the authors.
We can notice that most of the authors opt to take into account multiple objectives in their problems.Additionally, a great variety of solution approaches have been explored to address these problems, which include exact methods, evolutionary algorithms, a variety of metaheuristic procedures, and different combinations of methods from different areas.

AI-Based Solving Methods for V2G Optimization
V2G optimization problems typically involve complex optimization tasks related to managing the bidirectional flow of energy between EVs and the grid.These problems often involve factors such as vehicle availability, grid demand, charging station capacities, energy prices, and user preferences.Many V2G optimization problems are indeed NP-hard due to their combinatorial nature and the need to find optimal solutions among a large number of possible configurations [27].Some research, such as that conducted by Tan et al. [28], has mentioned the feasibility and popularity of GA and PSO as highly utilized approaches for addressing V2G problems.However, these two methods are not without limitations.One notable shortcoming is the low convergence efficiency, where the algorithms may converge to sub-optimal solutions before thoroughly exploring the solution space.Additionally, both GA and PSO may struggle with scalability when dealing with large-scale V2G systems or complex optimization objectives [29].
Intelligent x-heuristic algorithms offer several advantages when addressing optimization challenges in V2G systems.Firstly, simulation-based approaches provide greater flexibility in modeling complex systems and incorporating various constraints and objectives under uncertainty scenarios [30].Simulation-based algorithms can integrate detailed simulation models of V2G systems, capturing the intricacies of vehicle behavior, grid interactions, and uncertainties in external factors such as weather conditions and user preferences.This modeling approach enables a more accurate representation of real-world problems and facilitates the exploration of diverse solution spaces.Secondly, simulationbased algorithms are well suited for optimizing V2G systems in dynamic and uncertain environments.By utilizing stochastic simulation methods, these algorithms can effectively capture uncertainties and variations in system behavior, allowing for robust decisionmaking under uncertainty [31].
Applications of AI-based techniques, such as simheuristic, learnheuristic, and agile optimization, bring an unprecedented level of originality to V2G optimization.For instance, simheuristic can combine simulation and heuristics to model uncertainties and optimize energy exchanges, while learnheuristics use machine learning to predict patterns and improve decision-making.Agile optimization [32] ensures rapid adaptation to real-time data, making V2G systems more responsive and reliable.These techniques optimize energy distribution, support renewable energy integration, and contribute to a more sustainable and resilient power grid.AI-based algorithms can dynamically adjust to changing conditions, continually improving their performance without human intervention.This adaptive learning capability ensures that AI-driven solutions remain effective even as new data and scenarios emerge, providing a significant edge in the highly variable V2G environment [33].

Simheuristics
Simheuristic algorithms represent a powerful approach to solving optimization problems characterized by stochastic elements in their objectives or constraints [34].By combining simulation techniques with heuristics or metaheuristics, simheuristics aim to improve deterministic solutions addressing their stochastic counterparts, acknowledging that highquality deterministic solutions often translate to effective solutions in stochastic environments with a degree of variability.This approach employs a metaheuristic component to generate high-quality solutions for the deterministic version of the problem.Subsequently, these promising deterministic solutions undergo simulation to assess their performance in stochastic scenarios [35].In the V2G problems, the metaheuristic component generates solutions optimized for deterministic conditions, considering factors like energy efficiency or grid stability.These solutions are then subjected to simulation, where various stochastic scenarios are simulated to evaluate their performance under uncertainties.By incorporating simulation, simheuristics facilitate a deeper understanding of system dynamics and uncertainties inherent in V2G operations.Figure 1 shows the simheuristic framework to address the V2G optimization problems.The algorithm begins by transforming the stochastic optimization problem into a deterministic counterpart, achieved by substituting the expected values of the stochastic variables.Subsequently, within each iteration loop, a novel solution is generated which should be a promising solution.Following this, a short simulation, constrained by a limited number of iterations, is conducted to assess the feasibility of the solution.Upon completion of this preliminary evaluation, the solution undergoes an intensive simulation with a high number of iterations.Finally, a list of elite solutions is generated, culminating in the evaluation of their risk or reliability in the final step.

Learnheuristics
Learnheuristic algorithms represent an innovative approach to addressing optimization problems characterized by dynamic environments.The framework combines constructive heuristic methodologies with machine learning algorithms to efficiently predict the target variable and generate promising solutions iteratively.Initially, the framework generates input data for the machine learning module, which is then used iteratively to generate new promising solutions.Within each iteration, multiple runs of a constructive algorithm are performed, and solutions are evaluated.The solution with the best estimated objective value from these runs is selected as the promising solution.This iterative process allows for the generation of high-quality solutions while reducing the computational effort by replacing costly simulations with machine learning predictions [36].Figure 2 illustrates a general learnheuristic framework addressing the V2G optimization problems.V2G optimization involves dynamically balancing energy supply and demand, where decision costs fluctuate based on factors like charging/discharging schedules, grid conditions, and environmental conditions.Traditional optimization approaches may struggle to handle such dynamic decision costs efficiently, leading to suboptimal solutions or excessive computational overhead.However, the learnheuristic framework's ability to adaptively predict decision costs and generate promising solutions iteratively makes it well suited for addressing V2G optimization challenges.By utilizing machine learning algorithms to predict decision costs and guide the search for optimal charging/discharging schedules, learnheuristics can enhance grid stability, maximize energy utilization efficiency, and minimize costs for both users and utilities in V2G systems.Moreover, the framework's iterative nature allows it to continuously learn and improve its performance over time, making it particularly efficient in dynamic and uncertain environments like V2G systems.

Agile Optimization
V2G systems involve complex interactions between electric vehicles and the grid, considering factors such as varying energy demands, charging station capacities, fluctuating energy prices, and environmental considerations [37].In this context, agile optimization (AO) can address these challenges inherent in V2G optimization, providing flexibility, parallelization capabilities, and the rapid generation of solutions for dynamic environments.Additionally, the ability of AO to operate effectively with minimal intensive parameters further enhances its applicability in optimizing V2G systems.AO is an optimization approach that combines the principles of heuristic algorithms with controlled randomness to address complex problems.In this method, a deterministic constructive heuristic is augmented with randomness introduced through skewed probability distributions [38].This randomness allows for the exploration of diverse solution spaces without fundamentally altering the underlying logic of the heuristic.By incorporating a biased-randomized behavior, AO can efficiently generate high-quality solutions for dynamic optimization problems, such as those encountered in V2G systems.The biased-randomized heuristic in AO typically involves selecting building steps based on skewed probability distributions, where certain steps are favored over others [39].This controlled randomness enables AO to adapt to changing conditions, explore alternative solutions, and effectively address the complexities of real-world optimization problems [40].Figure 3 illustrates the AO framework.The main body of the AO algorithm is the circle representing the AO algorithm's iterative process.Within this circle, the constructive heuristic addresses the problem by employing biased-randomized techniques.In each iteration, the solution generated is evaluated.
Consequently, the algorithm generates multiple solutions at the same time.Ultimately, the best-found solution emerges as the output.

A Case Study
In this section, we present a relatively simple but illustrative case study aimed at addressing a straightforward problem concerning V2G systems.The problem revolves around minimizing the cost of charging electric vehicles.We will assume that each vehicle takes one hour to charge and discharge completely.We also assume that every hour of the day, a decision regarding whether a vehicle should be charged or discharged is made.Only full charge and discharge are allowed each hour, and three distinct pricing schedules are considered: expensive hours, medium hours, and cheap hours.These prices are scheduled throughout the day, selecting a price among the three options every four hours.This schedule is known at the start of the day, and once a vehicle arrives at the charging station, its departure time is known.Once a vehicle's departure time arrives, the vehicle needs to be fully charged.We will compare two scenarios.In the first scenario, a decision-making system is implemented, aiming to minimize the vehicles' charging cost.Conversely, in the second scenario, a decision-making method is not implemented, and vehicles are charged in the last hour before their departure, regardless of the price.

Mathematical Model
The problem can be formally defined as an optimization problem, where V = {1, 2, . . ., v} is the set of the vehicles, and T = {0, 1, 2, . . ., 24} is the set of the times.For each vehicle, the departure time, denoted as d i ∈ T\{0}, follows the arrival time a i ∈ T\{24}.For each vehicle i ∈ V, A i := {t ∈ T : a i ≤ t < d i } corresponds to the set of availability hours.We denote e t i as the energy level of vehicle i ∈ V at time t ∈ T, and c t shows the electricity cost at time t ∈ T. In addition, ĉt i is the associated cost of the charging for the vehicle i ∈ V at time t ∈ T, where ĉt i = c t (1 − e t i ).Parameter ŝt i is the saving price of energy for the vehicle i ∈ V at time t ∈ T, where ŝt i = c t e t i .Moreover, the binary variable x t i equals 1 if vehicle i ∈ V draws energy from the grid at time t ∈ T, and 0 otherwise.Similarly, another binary variable y t i equals 1 if vehicle i ∈ V supplies energy to the grid at time t ∈ T, and 0 otherwise.With these definitions, the mathematical formulation is as follows: The objective function (1) minimizes costs by considering whether a vehicle draws energy from the grid or supplies energy to it.Constraint (2) ensures that each vehicle can either draw energy from the grid or supply it to the grid but not both simultaneously.Constraint (3) ensures that vehicles drawing energy from the grid reach maximum energy capacity by the next hour (note that x t i = 1 and y t i = 0), while the levels of vehicles that supply energy to the grid are set to 0, as x t i = 0 and y t i = 1.Moreover, if no action occurs, i.e., x t i = 0 = y t i , for a vehicle at time t ∈ T, its energy level remains constant.Constraint (4) guarantees that every vehicle is charged at its departure time.These constraints should only activate if the vehicle is not fully charged when the time arrives; however, if the vehicle is fully charged at time d i − 1, its energy level will be equal to 1 and, therefore, setting x d−1 i to 1 will not affect the total cost.Constraint (5) states that the vehicles can draw energy from the grid only during the time they are available since after the departure time, vehicles cannot draw energy from the grid.Similarly, constraint (6) defines the supplying energy for the grid only in the availability times of the vehicles.Finally, constraints (7) and ( 8) refer to the binary characteristics of the x t i and y t i variables, respectively.

Solution Approach
The model presented is an optimization framework designed to manage the interaction between EVs and the power grid.In real-world applications, this model can be utilized to minimize the cost of electricity consumption while ensuring efficient energy distribution and storage.This model supports optimal decision-making for charging (or discharging) EVs at the right times, maintaining energy levels across time periods, and initial state constraints.Furthermore, utility providers can use electric vehicles as distributed energy resources, which enhances grid stability, reduces peak load, and facilitates more effective integration of renewable energy sources.
In order to solve the problem, a heuristic method has been developed.Figure 4 shows a flowchart of the algorithm.The heuristic acts as a decision-maker, determining whether each vehicle should charge, discharge, or wait until the next hour for each hour of the day.To make this decision, the algorithm requires information about the vehicles' arrival and departure times, as well as their state of charge upon arrival.The algorithm begins by generating a list of available vehicles for each hour, considering their arrival and departure times.If a vehicle's departure time is in the next hour, it is fully charged and removed from the list of available vehicles.For each remaining vehicle, a decision is made based on the current electricity price.If the price is low, the vehicle is fully charged.Conversely, if the price is high, the vehicle is discharged, and the energy is provided to the grid.When the electricity price is average, the algorithm considers the price for the next hour.If the next hour's price is high, the vehicle is charged, as the energy will be later supplied to the grid.If the next hour's price is low, the vehicle's energy is provided to the grid, as it will be charged at a lower price in the following hour.If the next hour's price is also average, the vehicle remains idle and waits for the next hour.Each time a vehicle is charged or discharged, the current cumulative cost is updated and at the end of the day, the algorithm returns the total cost.

Results and Validation
In this section, the problem discussed in the previous section is solved.For this case study, we consider a set of problems, each with a fleet of 500 vehicles.Problems are generated randomly; for instance, both the arrival and departure times of these vehicles are chosen randomly, without any constraints imposed on the duration of each vehicle's stay.The energy level of vehicles upon arrival is determined randomly and takes a value between 0 and 1, while three distinct pricing levels for energy are considered, these being 0.8 units per battery for the cheap value, 1 for the average price and 1.2 for the expensive one.Moreover, whether the electricity price is considered high, low, or average is also determined randomly, and changes every 4 h.The first scenario incorporates all constraints and definitions previously presented, and the proposed heuristic is used to solve it.In Figure 5, the evolution of the battery level of a vehicle caused by the decision-making of the heuristic can be observed.Conversely, in the second scenario, vehicles are only charged the hour before leaving, regardless of the electricity price.Figure 6 shows the dispersion of the solutions for both scenarios.The y-axis represents the total cost, where 1 is the cost of charging a battery of an EV at an average price.To compare the variances of the two scenarios, an analysis of variance (ANOVA) technique is applied to determine whether the means of the two samples are significantly different [41].According to the test results (p-value < 0.0001), it can be concluded that there are significant differences between the scenarios' means in terms of the objective function values.Consequently, the null hypothesis is rejected, which assumes equal means for both populations.In addition, the two populations satisfy the normality assumption.However, upon conducting a homoscedasticity test, it is revealed that the constancy in the variances is not met (p-value < 0.0001).Finally, following the non-parametric nature of our data, a signed-rank Wilcoxon test is performed to compare the medians of the two populations [42].The obtained p-value is significantly below the threshold of α = 0.01, leading us to reject the null hypothesis, suggesting a substantial difference in median performance metrics between the two scenarios.These findings underscore the statistical significance of the observed differences, with our approach showing a superior solution quality.The y-axis of Figure 6 represents the total cost when using each of the two algorithms described earlier.The results demonstrate that the heuristic model significantly reduces costs compared to the passive approach.On average, the mean cost of the solved problems is approximately 350 for the heuristic model, whereas it is around 500 for the passive one.Furthermore, it is worth noting that the best solution obtained by the second method falls above the 75th percentile of the first method's solutions.This means that, among all generated problems, the best outcome from the second algorithm is still worse than 75% of the solutions produced by the first one.Given that each point represents a distinct problem, with significant variability due to random generation, this demonstrates the effectiveness of the heuristic in solving this mathematical model, and highlights the effectiveness of the intelligent charging and discharging strategy.
Moreover, the results of the heuristic are compared with those of the exact method solved in Gurobi.Notably, the heuristic consistently returns the optimal solution to the problem.Since both methods produce the same results, Table 2 only compares the time in seconds each of them takes to solve different problems with the specified number of vehicles.Although both algorithms obtain the optimal solution, the traditional approach is significantly slower than the heuristic one.Moreover, once the number of vehicles is large enough, other bottlenecks start to appear aside from the system's speed, such as system memory.For instance, the exact method was not capable of solving the problem instance with 1,000,000 vehicles since it ran out of memory.Given the need for V2G systems to manage a large number of vehicles efficiently, it becomes clear that AI-driven methods should be prioritized.Additionally, the development and resolution of a more complex model is planned for future work; this case study, along with the algorithm and results obtained, aims to show the importance of applying intelligent algorithms in V2G systems.All the results in this section were obtained using a Chinese made personal computer (HP Omen 15-en1004ns) with 16 GB of RAM and an AMD Ryzen 5800H processor.

Challenges and Future Directions
In Section 2, some challenges regarding V2G and its implementation are discussed.These challenges encompass the dynamic nature of the problem, including fluctuating electricity prices throughout the day and ensuring a reliable supply of energy and EVs to support grid stability.Additionally, the costs associated with upgrading the power infrastructure and gaining public acceptance are significant obstacles that V2G must overcome for a successful implementation.For a V2G system to become fully operational, a large number of EVs are required.However, one of the significant limitations of EVs is their battery capacity.The limited capacity of current EV batteries restricts their driving range, leading to a phenomenon known as range anxiety, which is the primary concern of potential EV buyers [43].Consequently, when coupled with the lack of EV charging stations, EV users tend to be reluctant to participate in V2G systems, as they prefer to have a guaranteed amount of battery stored in case of emergencies or unforeseen circumstances.Therefore, the EV state of charge needs to be considered in order to reduce EV users' rejection of participating in V2G systems.Finding a balance between maximizing the primary objective of V2G systems and making them appealing to a wide range of drivers is essential when developing the V2G scheme and algorithm [44] since it is possible that maximizing the need for energy storage could conflict with the willingness of drivers to engage in V2G systems, which is often fueled by concerns like range anxiety.To mitigate these concerns, it is necessary to educate consumers about the benefits and safety of V2G systems.Providing assurances and guarantees, such as ensuring the guaranteed availability of a certain state of charge, can also help alleviate drivers' apprehensions.Moreover, other challenges encountered when dealing with V2G systems is grid control.In a V2G system, each EV serves as a generator, but a significant number of EVs are required to ensure grid stability.The grid operator needs to continuously monitor the condition and availability of these EV generators, as well as their willingness to participate, to identify those that are suitable for drawing energy from a specific battery pack [45].Integrating advanced grid management systems can help handle the complexity of V2G operations, and upgrading the infrastructure can make it more flexible and resilient.
Another highly influential parameter to consider is the degradation of EV batteries.While using EVs as energy storage units offers a valuable asset for balancing the electric grid's supply and demand, it also has a negative impact on their batteries.Battery cells deteriorate over time due to irreversible chemical reactions, leading to a reduction in the number of available lithium ions and subsequently, a decrease in cell capacity [46].This capacity variation depends on various parameters, including temperature, depth of discharge (the portion of the battery's capacity missing from its full capacity), and charge and discharge rates.Consequently, different challenges arise due to the impact of these parameters, including increased complexity of the problem due to the added restrictions and optimization of benefits, as degraded batteries negatively affect the potential benefits.Moreover, as emphasized in [47], V2G systems have the potential to adversely affect battery lifespan if not implemented correctly.A smart grid system, however, should have mechanisms in place to avoid or minimize this issue.Nonetheless, while lithiumion batteries currently dominate the market, models must acknowledge that maximizing return on investment for EV owners may not always be feasible, partly due to the societal constraints previously discussed.In such cases, energy trading between the grid and the vehicle should be based on prognostics [48].However, it is crucial to test this in various conditions due to the complex nature of battery degradation, as each commercial battery has a unique design, set of additives, and chemistry.Ideally, the entity developing the battery degradation model should be the company responsible for designing it, or at least the EV manufacturer.Smart charging algorithms that optimize charge/discharge cycles should be implemented to mitigate battery degradation, and, among other strategies, using batteries designed to withstand more cycles can further reduce degradation.

Data Challenges and Considerations
One of the primary challenges in integrating AI-driven methods is derived from data and their collection.For instance, in a V2G system formed by millions of vehicles, with each of them updating its status frequently to enable the algorithm to compute the optimal solution at each time point, the volume of data required would be immense.This poses significant problems not only in terms of storage capacity but also in processing power to analyze the data within a reasonable time frame.Given the importance of obtaining solutions to the problem in real time, a good combination of both hardware and software is needed to tackle the problem.Although the hardware component is important, a well-designed algorithm ensures that the hardware infrastructure is utilized optimally, enabling timely decision-making and action.Moreover, one should consider the safety and robustness of the model.Most of them are only focused on maximizing or minimizing some objective function, without considering the physical constraints regarding the stability properties, such as voltage regulations.Therefore, investing in research and development is essential to create advanced control algorithms and technologies that are capable of managing the complexity of V2G integration.Furthermore, as highlighted in [44], another set of challenges arising from the substantial data requirements includes identifying suitable data sources for algorithm development and evaluation.In order to develop algorithms suitable for real-life use, the need of highquantity real-world data arises.However, it is possible that certain algorithms, such as those employing reinforcement learning, might require more data than what are publicly available for their training phase [49], potentially impacting their accuracy.Therefore, in numerous cases, it becomes necessary to generate sample data, which could lead to problems regarding the scalability and representativeness of the model.Determining appropriate methods for evaluating and verifying large-scale V2G schemes and systems is also crucial, and the algorithms that have been developed should be subjected to testing in simulations or real-world scenarios to validate their functionality and evaluate their potential economic benefits across a wide range of settings, which includes diverse socio-economic contexts within cities or countries.For instance, Mangipinto et al. [50] developed a model covering 28 European countries, capable of simulating the charging profiles of individual EVs based on their mobility patterns.
Moreover, a related challenge in this domain is ensuring the security and privacy of individuals utilizing the V2G grid.Since the data contain sensitive information about where each person charges his/her vehicle and for how long, there exists the potential to find people's mobility patterns if a third party or a malicious user gains access to the data system.Therefore, regulating data collection and its access by third parties, as well as having a reasonable policy that is also socially accepted, could be an important milestone for establishing a V2G grid system.For instance, in an effort to mitigate some of the privacy issues from the algorithmic standpoint, Dong et al. [51] propose a multi-agent reinforcement learning algorithm.In this approach, each agent undergoes centralized training, yet they make decisions autonomously at the local level.This setup enables the maintenance of both autonomy and privacy, as individual agents retain control over their decision-making processes while benefiting from collective learning through centralized training.However, in actuality, V2G remains a niche, and only a limited number of users can currently benefit from it.As a result, the challenges posed by big data and their potential solutions are still largely unexplored.

Policy Implications and Future Opportunities
As EVs become more prevalent worldwide, numerous challenges arise, including both technical and policy implications.The first aspect is the mandatory investment cost required to upgrade the power system.These upgrades must encompass both software and hardware improvements.To enable the participation of an EV in the V2G system, a bidirectional battery charger is necessary, which includes a complex controller and high-tension cable.This requirement brings along safety considerations and a potential energy loss, which adds to this financial disadvantage [28].Moreover, implementing systems to mitigate frequency fluctuations and address load-shifting requirements due to increased intermittent power sources is crucial [52].It is also necessary to tackle the issues surrounding lithium batteries and the impact of V2G systems on them.To achieve this, extensive testing is necessary, alongside the development of improved models of EV battery degradation that consider their composition.This ensures that intelligent systems do not compromise battery lifespan.
Given the critical need for scalability in V2G systems [53], ensuring interoperability is essential.However, a notable challenge hindering V2G implementation is the presence of interoperability issues, particularly in EV charging stations.Some EVs from major manufacturers may not be compatible with certain charging stations.For instance, Tesla employs a proprietary connector, although they offer adapters to Tesla users to facilitate interoperability with other charging networks.As an example, CHAdeMO [54] has been proposed as a global industry standard, jointly developed by The Tokyo Electric Power Company, Mitsubishi, and Nissan.However, several other connectors exist, such as the SAE J1772 or IEC 61851 standards [55].Furthermore, interoperability challenges extend to the communication of micro-grids.As communication relies on sensors installed across all network components, each new device integration increases the number of connections, resulting in increasingly complex and slower communication [56].Hence, it becomes crucial to develop scalable infrastructures, guaranteeing secure and rapid communication among diverse devices.

Conclusions
This paper provides an overview of the challenges that must be addressed to implement V2G systems using AI solving methods.Some of the main functions modeled are discussed, including grid load control, economic cost optimization, and pollution generation minimization.Furthermore, the paper recognizes the necessity of accounting for uncertainties as well as the dynamic nature of the problem.Therefore, in order to provide realistic solutions, it is imperative to employ models capable of handling dynamism and uncertainties, such as those incorporating AI.These methods may include heuristics, machine learning approaches, or a combination of both such as those found in simheuristics and learnheuristics.
Furthermore, the paper introduces a case study to highlight the potential that V2G systems could have in the future.Our focus was on solving a scheduling problem related to determining the optimal times for charging or discharging a vehicle.While the study offers a simplified version of the problem, results demonstrate that even the integration of a basic algorithm can significantly reduce the operational costs of the grid compared to taking no action.Specifically, the experiment shows that the cost of inaction is roughly 50% higher than when employing the algorithm, highlighting the importance of V2G systems in order to reduce cost.In addition, the case study also shows how the use of newer technologies, such as AI-based methods, can significantly reduce the computation time required for solving these kind of problems when compared to classic exact methods.For future research, we aim to expand upon this concept by developing a model that incorporates dynamism and uncertainty, which will enable us to better capture the complexities of V2G systems and provide more accurate predictions and solutions.Finally, the paper addresses some of the challenges encountered during model preparation.These include considerations such as accounting for charging speed and battery degradation, addressing safety concerns associated with AI algorithms, and ensuring public acceptance.Moreover, once V2G systems become widespread, data concerns such as privacy and security should be a priority.
While V2G holds significant potential for the near future, there remains considerable groundwork to be performed to ensure its viability.Key challenges that need to be addressed include (i) investing in upgrading the power system infrastructure to accommodate the demands of V2G integration; (ii) improving lithium-ion batteries and developing models to better understand and mitigate their degradation over time; (iii) ensuring the scalability and interoperability of V2G systems to facilitate widespread adoption and seamless operation across different platforms and networks; (iv) addressing privacy and security concerns associated with the collection and utilization of sensitive data in V2G systems; (v) garnering public acceptance by finding a balance between optimizing the objective function of V2G systems and respecting the preferences and concerns of users; and (vi) developing more realistic models that not only address the challenges mentioned above but also align with the main goals of V2G implementations.

Figure 3 .
Figure 3. Agile optimization framework for dynamic and real-time optimization problems.

Figure 4 .
Figure 4. Flowchart of the solving algorithm.

Figure 5 .
Figure 5. Graphic showing the evolution of the battery level of a car related to the electricity price.

Figure 6 .
Figure 6.Dispersion of the solutions for both scenarios.

Table 1 .
Summary and classification of revised V2G systems references.

Table 2 .
Time in seconds each method needs to solve the problem.