Charging station dynamic pricing method fusing sample amplification and two-value depth deterministic strategy gradient algorithm
By combining U-Net, SimSiam and DBSCAN technologies, the D3PGSA algorithm constructed solves the problems of slow solving speed and data dependence in dynamic pricing of charging stations, and achieves an efficient and flexible pricing strategy suitable for dynamic market environments.
Patent Information
- Application Number
- CN202410929534.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing charging station dynamic pricing algorithms have problems such as slow solving speed, low computational efficiency, and easy to fall into local optimal solutions. They also rely on a large amount of training data, resulting in insufficient adaptability in a dynamic market environment.
Using the experience generation model based on U-Net and the feature generation model of SimSiam, combined with DBSCAN clustering, a dual-valued deep deterministic policy gradient algorithm (D3PGSA) is constructed. Through sample amplification and adjustment sampling, data dependence is reduced and the algorithm is improved in dynamics. Adaptability to market conditions.
It achieves more efficient dynamic pricing decisions for charging stations, improves solution quality and calculation efficiency, avoids local optimal solutions, and can be promoted and applied to problems of different scales.
Smart Images

Figure CN118780836A_ABST
Abstract
Description
Technical Field
[0001] The patent of this invention involves a dynamic pricing method for charging stations, which has important application prospects in the field of new energy transportation. Background Art
[0002] As the concept of environmental protection has become more popular and the government has introduced a large number of environmental protection policies, electric vehicles (EVs) have become an effective way to reduce greenhouse gas emissions and energy dependence, and have promoted changes in the transportation sector. However, the problem of insufficient number of electric vehicle charging stations (EVCS) and their uneven distribution has become increasingly prominent, which has affected the power grid load and threatened the stability of the user's power grid. Therefore, it is particularly important to establish sufficient supporting facilities to provide more clean energy and alleviate the power grid load during peak hours. Although the increase in the number of EVCS can help alleviate these problems, it also brings challenges such as capital investment, maintenance costs, and operating expenses. Reasonable pricing strategies are the key to solving this problem by dynamically adjusting charging prices, encouraging users to adjust their charging needs, maximizing the benefits of EVCS, and taking into account the interests of operators and users. Therefore, a dual-valued deep deterministic policy gradient algorithm D is proposed that integrates the experience generation model based on U-Net, the feature generation model based on SimSiam, and DBSCAN clustering. 3 PGSA (Dual-critic Deep Deterministic Policy Gradientbased on Sample Augmentation) is used to solve the data dependency and training instability problems of traditional DRL. The final learned strategy not only leads the traditional heuristic algorithm in terms of solution time, but also is very close to the optimal solution in terms of solution quality.
[0003] Because heuristic algorithms have the problems of slow solution speed, low computational efficiency, and easy to fall into local optimal solutions when solving the dynamic pricing problem of charging stations; and existing reinforcement learning (RL) algorithms, especially those based on deep learning, usually require a large amount of real data for training, and have problems of data dependence and unstable learning process. The present invention proposes a new dynamic pricing algorithm based on reinforcement learning. The algorithm comprehensively considers the operational constraints of the charging station and the needs of different users, aiming to maximize the operator's revenue while ensuring that the pricing strategy is within the acceptable range for consumers. By sample amplification and adjusting the sampling and learning strategies, the instability of the traditional RL algorithm and its dependence on a large amount of training data are solved, the adaptability of the algorithm in a dynamic market environment is improved, and an efficient and practical pricing tool is provided for charging station operators. Summary of the invention
[0004] Although heuristic algorithms have shown significant potential in solving optimization problems such as dynamic pricing of charging stations, they still have some limitations. In particular, when the solution space is very large or contains many local optimal solutions, the heuristic algorithm takes a long time to solve, and the search process may fall into the local optimal solution. Unlike heuristic algorithms, RL algorithms do not rely on the specific form of the problem, but learn the optimal strategy through interaction with the environment. This makes RL more flexible and able to adapt to changing environments and different tasks. And RL avoids falling into local optimal solutions through exploration and utilization mechanisms, making it easier to find global optimal solutions or better solutions. It is the Deep Deterministic Policy Gradient (DDPG) algorithm and its variants. However, the traditional DDPG algorithm still exhibits the following limitations when applied to the problem of dynamic pricing of charging stations: (1) DDPG often requires a large number of experience samples for training. However, in most cases, the economic cost or time cost of obtaining data is high and difficult, which limits the feasibility and efficiency of DDPG in certain scenarios. (2) The algorithm has the problem of overestimating the state-action value, which may cause the strategy to tend to be overly optimistic, increase the cumulative error, and have a negative impact on the long-term training efficiency and stability, thereby affecting the accuracy of the final pricing decision. (3) In the traditional DDPG framework, random sampling of the experience pool may ignore the importance and diversity of samples, reduce training efficiency, affect the comprehensiveness of learning and the adaptability of the strategy, and the lack of distinction between sample importance may lead to overfitting.
[0005] In order to solve the above problems, the present invention designs a charging station dynamic pricing method that integrates sample amplification and a dual-value deep deterministic policy gradient algorithm. The present invention mainly includes seven parts: (1) Problem modeling of dynamic pricing of charging stations. (2) Markov decision process modeling. (3) Constructing an experience generation model based on U-Net (4) Constructing a feature generation model based on SimSiam (5) Constructing an experience replay pool based on cluster balanced sampling (6) Constructing a reinforcement learning training framework based on dual-value deep deterministic policy gradient (7) Experimental verification of the effectiveness of the algorithm.
[0006] The following are the contents of the above seven parts:
[0007] 1. Model the problem of dynamic pricing of charging stations. Define the problem according to the actual situation, and define the decision variables and objective function of dynamic pricing of charging stations.
[0008] 2. Markov decision process modeling. In the dynamic pricing problem of charging stations, the arrival of vehicles at the charging station in each time period and the charging station's execution of pricing actions can be regarded as a decision sequence. In the present invention, such a pricing process is modeled as a Markov decision process.
[0009] 3. Construct an experience generation model based on U-Net. The training of the DDPG algorithm often requires a large number of experience samples, and in most cases it is difficult and costly to obtain experience. Therefore, the present invention constructs an experience generation model based on U-Net. The new experience samples generated by it not only follow the statistical characteristics of the original data, but also increase the diversity of experience samples, which can help the Agent learn more comprehensively about the unseen states in the environment, thereby improving the generalization ability and solution quality of the algorithm.
[0010] 4. Construct a feature generation model based on SimSiam. Since the empirical data is highly correlated, directly clustering the empirical samples in the subsequent clustering operation may produce deviations and be easily affected by the noise of the original data, resulting in poor clustering effect. Therefore, the present invention constructs a feature generation model based on SimSiam, the purpose of which is to provide effective feature representation for subsequent clustering operations through unsupervised learning methods.
[0011] 5. Construct an experience replay pool based on cluster balanced sampling. The random sampling method of the experience pool in the traditional DDPG framework often ignores the importance and diversity of samples, resulting in a decrease in training efficiency and affecting the comprehensiveness of learning and the adaptability of the strategy. At the same time, failure to distinguish the importance of samples may also lead to overfitting. Therefore, the present invention designs an experience replay pool based on cluster balanced sampling, aiming to improve sample utilization efficiency and training effect.
[0012] 6. Construct a reinforcement learning training framework based on dual-value deep deterministic policy gradient. The single value network of traditional DDPG often overestimates the action value, which may cause estimation errors and lead to unstable model training. Therefore, the present invention constructs a dual-value network to reduce the estimation error, thereby enhancing the stability and efficiency of the training process.
[0013] 7. Experimental verification of the effectiveness of the model. Experiments have shown that compared with existing reinforcement learning algorithms, the present invention has higher quality solutions at similar computing time, and has higher solution quality and shorter computing time than most traditional heuristic methods. More importantly, the learned strategies can be well generalized to problems of different scales.
[0014] The detailed implementation steps taken by the present invention to achieve the above-mentioned purpose are as follows:
[0015] Step 1: Modeling the problem of dynamic pricing of charging stations. The present invention constructs a detailed model to simulate the use of charging stations by EVs in a day. The model takes into account multiple factors, including the battery status of the vehicle, charging demand, charging time, user sensitivity to price, and user personality differences. In the present invention, it is assumed that the charging station cannot obtain any information about the future arrival of electric vehicles and electricity prices in future time periods, including their distribution information. In this case, the charging station cannot predict when the electric vehicle will arrive and the demand in future time periods, so these events are non-causal for the charging station.
[0016] The core issue of dynamic pricing of charging stations is to ensure that the electricity price is within the acceptable range for users and that the owners of charging stations can obtain the maximum profit. Therefore, in the present invention, the profit of charging stations is set as the optimization target, and its objective function is:
[0017]
[0018] Where R represents the total revenue of the charging station, p T-1 represents the charging station price at time T-1, ct i represents the charging time of the i-th vehicle.
[0019] Consider the operation of a charging station in a day, which is divided into 24 time steps to simulate the charging demand and behavior of EVs in different periods. In each time step, the generation of EVs is random, and its number is roughly consistent with the actual situation. All EVs in each time step are recorded as a set V T The present invention uses bs i ,ct i and em i Indicates the battery status of the EV, charging time, and the urgency of the vehicle. The battery status refers to the remaining power and the total battery capacity. i The ratio of charging time ct i The calculation method is:
[0020]
[0021] Where P represents the charging power of the charging station.
[0022] Vehicle urgency level i Calculated based on the current battery status:
[0023]
[0024] Assuming that users are sensitive to charging prices when making charging decisions, the results will be significantly affected by the current charging prices. The user's decision model contains three key parameters: w q , w p and αi , w q represents the influence weight of the waiting area queue length of the charging station when the user makes a decision, w p represents the influence weight of the current price. In addition, α i The parameters introduced to simulate the personality characteristics of different EV users follow a normal distribution with a mean of 1 and a standard deviation of 0.3. q and w p The calculation formula is:
[0025] w q =0.5+β×em i
[0026] w+w=1
[0027] qp
[0028] Where β is a parameter for adjusting the urgency weight.
[0029] The final decision result is determined based on the comprehensive score calculated by these parameters. When the score reaches the decision threshold ν, the user chooses to charge. If there is an idle charging pile, the EV starts charging directly, otherwise it waits in the waiting area. The decision function is:
[0030]
[0031] where r q represents the current occupancy rate of the waiting area of the charging station, p max Indicates the highest charging price that the user can accept.
[0032] Charging stations are available on a first-come, first-served basis for waiting areas and assembly areas. T The vehicles in the station are charged, and the charging fee is collected after charging is completed and included in the total revenue of the charging station.
[0033] Step 2: Markov decision process modeling. In the dynamic pricing problem of charging stations, the arrival of vehicles at the charging station in each time period and the charging station's execution of pricing actions can be regarded as a decision sequence. In this invention, such a pricing process is modeled as a Markov decision process (MDP), which consists of a four-tuple<S,A,R,η> Denotes, S denotes the state space, A denotes the action of the agent, R denotes the reward function, and η denotes the noise used for exploration. The elements of MDP, namely the state space, action space, reward function, and exploration noise, are defined as follows:
[0034] Step 2.1: State. S represents the state space, and the state information s at each time step T ∈S includes the current electricity price of the charging station, the occupancy rate of the charging piles at the charging station, the occupancy rate of the waiting area, and the current time step information; in the environment, the state of each time step is recorded as a set in represents the occupancy rate of the waiting area at time step T, represents the usage rate of the charging pile at time step T. The environment accepts the Agent based on s at each time step. T The action made T To adjust the charging price p T , these actions will affect the state evolution in the future time step. Further define the state transition mode of the environment s T+1 =F(s T ,a T ), s T+1 is the system state of the next time step, and F is the state transfer function, which is specifically defined as:
[0035]
[0036] in is the number of charging piles in use, is the number of EVs in the waiting area.
[0037] s T+1 The information in is updated as follows:
[0038]
[0039] Where N c is the total number of charging piles, N q The total number of parking spaces in the waiting area.
[0040] Step 2.2: Action. A represents the action set. In state s T When the agent takes action a T ∈[-0.5, 0.5] represents the price adjustment method at each time step, a positive number indicates a price increase, and a negative number indicates a price decrease. Before the agent interacts with the environment each time, it first initializes the environment, transfers the dictionary, etc. The agent returns the state s fed back by the environment at each time step. T As input to the model Find the corresponding pricing action a through the policy network T and passed to the environment.
[0041] The core goal of the agent is to determine a behavior strategy μ θ , the strategy guides the agent to different states s at each time step T Take the best action a T Finally, we find an optimal strategy μ θ * , aiming to maximize the cumulative discounted return throughout the process. That is:
[0042]
[0043] Where γ is the attenuation factor used to measure the importance of future returns, and 0≤γ<1, R T is the reward at T time steps.
[0044] Step 2.3: Reward function. R represents the reward function in the process of interaction between the environment and the agent, that is, the target value. At each time step, when a vehicle is fully charged, the revenue will be included in the reward of that step. In the reward design of the environment, the present invention introduces a "delayed reward" mechanism, that is, the environment will take the revenue generated by the EV that arrives at the charging station in step T-1 after completing charging in step T as the reward R of step T. T This design takes into account the particularity of the charging station pricing strategy, that is, there is a certain time delay between the pricing of charging services and the actual payment of car owners. This reward structure helps the agent learn how to optimize long-term benefits instead of just pursuing immediate economic benefits. In addition, this design also simulates the common phenomenon of delayed benefits in real-world economic decision-making, increasing the practical applicability of the model. Therefore, the reward R T The calculation method is as follows:
[0045]
[0046] Step 2.4: Exploration noise. η represents random noise, and its value range is η∈[-0.5,0.5], and it will gradually decrease with the increase of training times. Since the DDPG algorithm adopts a deterministic strategy, its own exploration is still very limited, so it is necessary to introduce a random noise η in the behavior strategy to enhance the agent's exploration ability:
[0047] a T =μ θ (Input T )+η
[0048] Step 3: Build an experience generation model based on U-Net. The core is a structured U-Net neural network that enhances the diversity and representation of data by comprehensively utilizing temporal information and spatial features. The architecture of the model is as follows Figure 3 shown.
[0049] The present invention uses the Consistency Training (CT) method to train the model. First, Gaussian noise is added to the input x:
[0050]
[0051] where t n For an earlier time point, t n+1 are later time points, all belonging to the same time point sequence, t i Generated by the following formula:
[0052]
[0053] Where ξ is used to make nonlinear changes to the time scale, N is the total number of generated discrete time points, and Τ is the maximum range of time discretization.
[0054] Secondly, for t n To timecode:
[0055] t emb =concat(sin(t n ·freq),cos(t n ·freq))
[0056] Where freq is a set of frequencies uniformly distributed in logarithmic space, the purpose of which is to convert time t n Converting to a form that can be processed by sine and cosine functions allows time information to be embedded in the data in a continuous periodic manner.
[0057] Finally, t emb and Input to the feature extraction part of the model. Feature extraction mainly uses a module (DSC) composed of multi-layer convolution and nonlinear activation function to process data. The specific processing process is as follows:
[0058]
[0059] The first layer of feature extraction is the downsampling layer, which consists of a two-dimensional convolutional network and three DSCs. Downsampling can retain important features in the input data while filtering out redundant information. In addition, during the downsampling process, each layer will be temporally embedded:
[0060]
[0061] At the same time, residual connections are made to the data every other layer:
[0062]
[0063] As the network depth increases, these features may be difficult to reconstruct in the subsequent upsampling process, so in the downsampling layer, the model jumps to preserve certain key features.
[0064] The second layer of feature extraction is the middle layer, which also uses DSC. The extraction of data features is then deepened through the middle layer, which is the core of information processing in the model and provides rich contextual information for the subsequent upsampling process.
[0065] The third layer of feature extraction is the upsampling layer, which has a similar structure to the downsampling layer. The model needs to reconstruct details close to the original input data in the upsampling layer, so the features saved at the corresponding time point during the downsampling process are fused with the current features to ensure that there is both high-level abstract information and specific information from lower layers in the feature reconstruction process. The rest of the processing is basically the same as the downsampling layer.
[0066] The final output layer of the model calculates the weights and Combining the original input and the features processed by the network, the produced data is modified to enhance the details and quality of the model output. The process is as follows:
[0067]
[0068] where x ori is the original input of the model.
[0069] The model parameters are fitted by minimizing the Loss function, which is defined as:
[0070]
[0071] Where λ is used to assign different importance to different time steps. are the weights for the EMA version of the model.
[0072] When using the trained model to generate experience, in order to avoid large errors in the generated data, the present invention chooses the 5-step sampling method and abandons the faster 1-step sampling. The specific sampling process is shown in (26):
[0073]
[0074] That is, first add noise τ to the given x n Steps to get pass Get the output, and then add noise τ to the output n Steps to get and enter Executing the above operation five times in a loop is called five-step sampling, which can reduce the error of generated data.
[0075] Step 4: Construct a feature generation model based on SimSiam. The present invention constructs a feature generation model based on SimSiam, the purpose of which is to provide effective feature representation for subsequent clustering operations through an unsupervised learning method. Figure 4 shown.
[0076] The training method of the model in the present invention is:
[0077]
[0078] y masked =y noised ⊙(1-M),M~Bernoulli(mask_prob)
[0079] First, data enhancement is performed on the input experience sample y to obtain two perturbed versions. is a normally distributed random variable with mean 0 and standard deviation noise_level. I is the identity matrix, indicating that the noise is independent and identically distributed. The element M is a Bernoulli random variable that takes the value 1 with probability mask_prob and takes the value 0 with probability (1-mask_prob).
[0080] Then the two perturbed versions of y masked1 and masked2 Input to the same Encoder for feature extraction, and get two different vectors k1, k2. Use a prediction network to predict the features of k2 from k1, and predict the features of k1 from k2, and get feature vectors o1, o2 respectively. Finally, calculate the symmetric loss (cosine similarity) of the two prediction results. The symmetric loss ensures that the network can not only accurately predict the features of one experience from the features of another experience, but also have the same effect in reverse. Its loss function is defined as:
[0081]
[0082] Stopgrad is a "stop gradient" technique, which aims to prevent the model from falling into a degenerate solution (i.e., the feature collapses to a constant) and further improve the stability of learning. D is the cosine similarity, and the calculation formula is:
[0083]
[0084] After saving the trained model parameters, the Agent inputs y into the feature generation model to represent its features:
[0085] {o1,o2,...,o w}={f s (y1),f s (y2),...,f s (y w )}
[0086] And all the features are recorded as a set O = {o1, o2, ..., o w}, feature o i The corresponding experience index is stored in the experience pool for subsequent clustering.
[0087] Step 5: Construct an experience replay pool based on clustering balanced sampling. In order to further improve the sample utilization efficiency and training effect, after the Agent completes the above sample amplification operation, it will use the DBSCAN algorithm to cluster the experience samples based on set O. The clustering process is as follows:
[0088] For any feature o∈O of an empirical sample, its ε neighborhood is first determined by the following method:
[0089] Y ε (o)={j∈O|dist(o,j)≤ε}
[0090] Where dist(o,j) represents the distance between o and j.
[0091] If the ε neighborhood of o contains at least MinPts points, that is, |Y ε (o)|≥MinPts,|Y ε (o)| is the number of data points in the ε neighborhood of o, then mark the point as a core point. Then create a new cluster and mark all points in o and its neighborhood as belonging to the same cluster. Traverse each point in the neighborhood, and if there are other core points, mark all points in its neighborhood as belonging to the same cluster.
[0092] For other sample points other than core points, they are defined as boundary points and noise points respectively by the following formulas:
[0093]
[0094] |Y ε (o)|<MinPts andój∈O|o∈|Y ε (j)|
[0095] Starting from any unmarked point, repeat the above steps until all points are marked as visited and classified into clusters or marked as noise points.
[0096] In addition, the present invention proposes CBSampling to sample empirical samples, that is, before each sampling, the number of samples to be extracted from each cluster is calculated:
[0097]
[0098] in is the rounding down symbol, B is the total number of samples to be extracted, and K is the number of clusters after clustering, which ensures that at least one sample is selected in each cluster. After randomly sampling in each cluster according to H, if the final number of samples is insufficient, samples are randomly supplemented from the entire experience pool until the required number of samples is reached.
[0099] This sampling strategy aims to balance the frequency of occurrence of various types of samples in model training, thereby avoiding model bias caused by too many samples of certain categories. Through targeted sample utilization, the model's responsiveness and adaptability to key states are enhanced. At the same time, the Agent will regularly update and cluster new experience samples that are subsequently stored in the experience pool.
[0100] Step 6: Construct a reinforcement learning training framework based on dual-value deep deterministic policy gradient. In order to make the model training process as stable as possible, the present invention constructs a dual-value network to reduce the estimation error. Its structure is as follows: Figure 5 As shown. The agent that completes all the above operations will update the parameters of the policy network and the value network at each time step. The update includes the following process.
[0101] After the agent completes the interaction with the environment at the current time step, it takes out the experience samples for training through CBSampling. Since there are two Critic networks, the state s in these experience samples is estimated by the following formula T+1 Take action a T+1 The value of:
[0102]
[0103] Then, the temporal difference target of the empirical sample is calculated based on the estimate T , the calculation formula is as follows:
[0104] target T =R T +γmin(Q1(s T+1 ,a T+1 ),Q2(s T+1 ,a T+1 ))
[0105] Then according to target T Calculate the Loss values of the two networks separately:
[0106]
[0107] The gradient calculation formula of the value network is as follows:
[0108]
[0109] To maximize the reward, the loss function of the policy network is defined as:
[0110]
[0111] in To calculate the target TThe value network that takes the minimum value when . The policy gradient calculation formula is as follows:
[0112]
[0113] In addition, the target network adopts a soft update method, that is, the target network is updated slowly and gradually approaches the Critic network and the Actor network. The formula is as follows:
[0114]
[0115] θ - ←τθ+(1-τ)θ -
[0116] Usually τ is a relatively small parameter. When τ = 1, it is equivalent to directly copying the critic network parameters to the target network. The target network also uses this soft update method.
[0117] The present invention proposes a solution for an improved deep deterministic policy gradient algorithm, namely D 3 PGSA. This model realizes effective learning of the agent policy network by integrating the experience generation model and the DBCSAN clustering based on the feature generation model, as well as the dual-value network, thereby achieving reasonable price regulation and providing an effective theoretical basis for dynamic pricing decisions. These improvements ensure that the experience samples used for agent training have sufficient diversity and solve the problem of low utilization of experience samples in traditional DDPG. The design of the dual-value network reduces the errors that may be caused by a single estimation network, improves the stability of model training, and thus improves the accuracy of the pricing strategy. At the same time, it can be well generalized to different problem sizes. BRIEF DESCRIPTION OF THE DRAWINGS
[0118] Figure 1 This is a schematic diagram of the dynamic pricing problem of charging stations in the present invention.
[0119] Figure 2 D 3 PGSA framework diagram
[0120] Figure 3 This is a schematic diagram of the structure of the experience generation model in the present invention.
[0121] Figure 4 This is a schematic diagram of the feature generation model structure in the present invention.
[0122] Figure 5 This is a schematic diagram of the reinforcement learning training framework of the dual-value deep deterministic policy gradient in the present invention.
[0123] Figure 6 It is the characteristic distribution diagram of different scale data sets constructed in the present invention
[0124] Figure 7 D 3 Convergence curves of PGSA and heuristic algorithms on different data sets
[0125] Figure 8 D 3 Convergence curves of PGSA and other reinforcement learning algorithms on different data sets
[0126] Fig. 9 This is the result of the hyperparameter verification experiment in the present invention.
[0127] Fig.10 This is the convergence curve of the ablation experiment in the present invention.
[0128] Fig.11 This is the verification diagram of the ablation experiment results in the present invention DETAILED DESCRIPTION
[0129] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0130] Aiming at the problem of dynamic pricing of charging stations, the present invention establishes a deep reinforcement learning simulation environment with Markov, and designs a dynamic pricing method for charging stations that integrates sample augmentation and a dual-value deep deterministic policy gradient algorithm.
[0131] Step 1: Consider the operation of a charging station in a day and divide it into 24 time steps to simulate the charging demand and behavior of EVs in different periods. Assume that the current time step of the environment is 10. In this time step, the generation of EVs is random, and its number is roughly consistent with the actual situation. All EVs in this time step are recorded as a set V 10 .
[0132] The core issue of the power station dynamic pricing problem is to ensure that the electricity price is within the acceptable range for users and that the charging station owner can obtain the maximum profit. Therefore, the present invention sets the charging station profit as the optimization target and establishes the following mathematical model:
[0133]
[0134] Where R represents the total revenue of the charging station, p T-1 represents the charging station price at time T-1, ct i represents the charging time of the i-th vehicle. 10 The vehicles in the game have their own battery status bs i , Charging time ct i and the urgency of the vehicle i Equivalent properties, ct i The calculation is as follows:
[0135]
[0136] Among them bc i is the total battery capacity, and P is the charging power of the charging station.
[0137] Vehicle urgency level i Calculated based on the current battery status:
[0138]
[0139] Assuming that users are sensitive to charging prices when making charging decisions, the results will be significantly affected by the current charging prices. The user's decision model contains three key parameters: w q , w p and α i , w q represents the influence weight of the waiting area queue length of the charging station when the user makes a decision, w p represents the influence weight of the current price. In addition, α i The parameters introduced to simulate the personality characteristics of different EV users follow a normal distribution with a mean of 1 and a standard deviation of 0.3. q and w p The calculation formula is:
[0140] w q =0.5+β×em i
[0141] w+w=1
[0142] qp
[0143] Where β is a parameter for adjusting the urgency weight.
[0144] The final decision result is determined based on the comprehensive score calculated by these parameters. When the score reaches the decision threshold ν, the user chooses to charge. If there is an idle charging pile, the EV starts charging directly, otherwise it waits in the waiting area. The decision function is as follows:
[0145]
[0146] where r q represents the current occupancy rate of the waiting area of the charging station, p max Indicates the highest charging price that users can accept. Charging stations are based on the first-come, first-served principle for waiting areas and assembly V 10 The vehicles in the station are charged, and the charging fee is collected after charging is completed and included in the total revenue of the charging station.
[0147] Step 2: In the present invention, the charging station dynamic pricing process is modeled as a Markov decision process (MDP), which consists of four tuples:<S,A,R,η> Indicates, S represents the state space, A is the action of the agent, R is the reward function, and η is the noise used for exploration.
[0148] (1) Assume that the current environment is the 10th time step, then the current state in represents the occupancy rate of the waiting area at the current time step, represents the usage rate of the charging pile at the current time step. The environment accepts the Agent based on s at this time step. 10 The action made 10 To adjust the charging price p 10 , this action will affect the state evolution in the future time step. Further, the state transition function s T+1 =F(s T ,a T ) to get the state s of the next time step 11 , F is the state transfer function, and the specific calculation method is as follows:
[0149]
[0150] in is the number of charging piles in use in the next time step, is the number of EVs in the waiting area at the next time step.
[0151] s 11 The information in is updated by the following formula:
[0152]
[0153] Where N c is the total number of charging piles, N q The total number of parking spaces in the waiting area.
[0154] Step 3: Since the training of the DDPG algorithm requires a large number of experience samples, the present invention constructs an experience generation model based on U-Net to generate a large number of experience samples to help the Agent learn more comprehensively about the unseen states in the environment, thereby improving the generalization ability and solution quality of the algorithm. The optimization goal of this model is:
[0155]
[0156] Where Exp is the experience sample obtained by the Agent's early interaction with the environment. It is the data after transforming the experience sample.
[0157] The present invention first adds Gaussian noise to Exp, and Exp is recorded as x in the following formula:
[0158]
[0159] where t i is the time point used for adding noise, calculated as:
[0160]
[0161] Where ξ is used to make nonlinear changes to the time scale, N is the total number of generated discrete time points, and Τ is the maximum range of time discretization.
[0162] Secondly, for t n To timecode:
[0163] t emb =concat(sin(t n ·freq),cos(t n ·freq))
[0164] Where freq is a set of frequencies uniformly distributed in logarithmic space, the purpose of which is to convert time t n Converting to a form that can be processed by sine and cosine functions allows time information to be embedded in the data in a continuous periodic manner.
[0165] Finally, t emb and Input to the feature extraction part of the model. Feature extraction mainly uses a module (DSC) composed of multi-layer convolution and nonlinear activation function to process data. The specific processing process is as follows:
[0166]
[0167] The first layer of feature extraction is the downsampling layer, which consists of a two-dimensional convolutional network and three DSCs. Downsampling can retain important features in the input data while filtering out redundant information. In addition, during the downsampling process, each layer will be temporally embedded:
[0168]
[0169] At the same time, residual connections are made to the data every other layer:
[0170]
[0171] The final output layer of the model calculates the weights and Combining the original input and the features processed by the network, the produced data is modified to enhance the details and quality of the model output. The process is as follows:
[0172]
[0173] where x ori is the original input of the model.
[0174] When using the trained model to generate experience, in order to avoid large errors in the generated data, the present invention chooses the 5-step sampling method and abandons the faster 1-step sampling. The specific sampling process is as follows:
[0175]
[0176] That is, first add noise τ to the given x n Steps to get pass Get the output, and then add noise τ to the output n Steps to get and enter Executing the above operation five times in a loop is called five-step sampling, which can reduce the error of generated data.
[0177] Step 4: Since the empirical data is highly correlated, direct clustering of the empirical samples in the subsequent clustering operation may produce deviations and is easily affected by the noise of the original data, resulting in poor clustering results. Therefore, the present invention constructs a feature generation model based on SimSiam, the purpose of which is to feature the empirical samples so that the experience can be clustered more accurately in the future. The optimization goal is:
[0178]
[0179] in From Exp w The empirical samples obtained by sampling, Exp w is the union of all experience samples, that is, Exp and the generated virtual experience samples. and For input Two perturbed versions of ω is the encoder and g is the prediction head.
[0180] The present invention first performs data enhancement on the input empirical samples to obtain two perturbed versions. Let it be y:
[0181]
[0182] y masked =y noised ⊙(1-M),M~Bernoulli(mask_prob)
[0183] in is a normally distributed random variable with mean 0 and standard deviation noise_level. I is the unit matrix, indicating that the noise is independent and identically distributed. Element M is a Bernoulli random variable that takes the value 1 with probability mask_prob and takes the value 0 with probability (1-mask_prob). Then the two perturbed versions of y are masked1 and masked2 Input into the same Encoder for feature extraction to obtain two different vectors k1 and k2. Use a prediction network to predict the features of k2 from k1, and predict the features of k1 from k2, to obtain feature vectors o1 and o2 respectively.
[0184] Finally, the trained model is used to characterize all experiences:
[0185] {o1,o2,...,o w}={f s (y1),f s (y2),...,f s (y w )}
[0186] And all the features are recorded as a set O = {o1, o2, ..., o w}, feature o i The corresponding experience index is stored in the experience pool for subsequent clustering.
[0187] Step 5: In order to further improve the utilization efficiency and training effect of samples, the present invention also uses the DBSCAN algorithm to cluster the empirical samples based on the set O. The clustering process is as follows:
[0188] First, determine any o by the following formula i The ε neighborhood of .
[0189] Y ε (o)={j∈O|dist(o,j)≤ε}
[0190] Where dist(o,j) represents the distance between o and j.
[0191] If the ε neighborhood of o contains at least MinPts points, that is, |Y ε (o)|≥MinPts,|Y ε (o)| is the number of data points in the ε neighborhood of o, then mark the point as a core point. Next, create a new cluster and mark all points in o and its neighborhood as belonging to the same cluster. Traverse each point in the neighborhood, and if there are other core points, mark all points in its neighborhood as belonging to the same cluster.
[0192] Finally, non-core points are determined as boundary points or noise points according to the following formula:
[0193]
[0194] |Y ε (o)|<MinPts andój∈O|o∈|Y ε (j)|
[0195] Starting from any unmarked point, repeat the above steps until all points are marked as visited and classified into clusters or marked as noise points.
[0196] In addition, the present invention proposes CBSampling to sample empirical samples, that is, before each sampling, the number of samples to be extracted from each cluster is calculated:
[0197]
[0198] in is the rounding down symbol, B is the total number of samples to be extracted, and K is the number of clusters after clustering, which ensures that at least one sample is selected in each cluster. After randomly sampling in each cluster according to H, if the final number of samples is insufficient, samples are randomly supplemented from the entire experience pool until the required number of samples is reached.
[0199] Step 6: In the present invention, after all the above operations are completed, the parameters of the policy network and the value network will be updated at each time step of the agent's interaction with the environment. First, the experience samples for training are taken out through CBSampling, and the two critic networks estimate the state s in these experience samples. T+1 Take action a T+1 The values of Q1 and Q2 are obtained. Secondly, the time difference target of the empirical sample is calculated based on Q1 and Q2, and then the Loss values of the two networks are calculated based on the target. Finally, the gradient corresponding to each network is calculated based on the Loss value and the parameters are updated. When certain conditions are met, the parameters of the respective target networks are soft-updated.
[0200] In the verification, SA, GA, GWO, PSO, PPO, and SAC algorithms were used as baseline algorithms to verify D 3 The performance of PGSA on datasets of different sizes is shown, and representative verification examples and analysis of heuristic algorithms and reinforcement learning algorithms are given. The effectiveness of the proposed method is verified through ablation experiments. The final results show that D 3 The PGSA model has advantages over traditional heuristic algorithms and deep reinforcement learning algorithms in terms of solution time and solution quality.
Claims
1. A charging station dynamic pricing method integrating sample amplification and dual-value deep deterministic policy gradient algorithm, characterized in that The steps include: Definition: This paper proposes a charging station dynamic pricing method that integrates sample augmentation and dual-value deep deterministic policy gradient algorithm, namely D 3 PGSA. This model achieves effective learning of the agent policy network by integrating the experience generation model and DBCSAN clustering based on the feature generation model, as well as the dual-value network, thereby achieving reasonable price regulation and providing an effective theoretical basis for dynamic pricing decisions. These improvements ensure that the experience samples used for agent training have sufficient diversity and solve the problem of low utilization of experience samples in traditional DDPG. The design of the dual-value network reduces the errors that may be caused by a single estimation network, improves the stability of model training, and thus improves the accuracy of the pricing strategy. Step 1: Modeling the problem of dynamic pricing of charging stations. The present invention constructs a detailed model to simulate the use of charging stations by EVs in a day. The model takes into account multiple factors, including the battery status of the vehicle, charging demand, charging time, user sensitivity to price, and user personality differences. In the present invention, it is assumed that the charging station cannot obtain any information about the future arrival of electric vehicles and electricity prices in future time periods, including their distribution information. In this case, the charging station cannot predict when the electric vehicle will arrive and the demand in future time periods, so these events are non-causal for the charging station. The core issue of dynamic pricing of charging stations is to ensure that the electricity price is within the acceptable range for users and that the owners of charging stations can obtain the maximum profit. Therefore, in the present invention, the profit of charging stations is set as the optimization target, and its objective function is: Where R represents the total revenue of the charging station, p T-1 represents the charging station price at time T-1, ct i represents the charging time of the i-th vehicle. Consider the operation of a charging station in a day, which is divided into 24 time steps to simulate the charging demand and behavior of EVs in different periods. In each time step, the generation of EVs is random, and its number is roughly consistent with the actual situation. All EVs in each time step are recorded as a set V T The present invention uses bs i ,ct i and em i Indicates the battery status of the EV, charging time, and the urgency of the vehicle. The battery status refers to the remaining power and the total battery capacity. i The ratio of charging time ct i The calculation method is: Where P represents the charging power of the charging station. Vehicle urgency level i Calculated based on the current battery status: Assuming that users are sensitive to charging prices when making charging decisions, the results will be significantly affected by the current charging prices. The user's decision model contains three key parameters: w q , w p and α i , w q represents the influence weight of the waiting area queue length of the charging station when the user makes a decision, w p represents the influence weight of the current price. In addition, α i The parameters introduced to simulate the personality characteristics of different EV users follow a normal distribution with a mean of 1 and a standard deviation of 0.
3. q and w p The calculation formula is: In q =0.5+β×em i In q +in p =1 Where β is a parameter for adjusting the urgency weight. The final decision result is determined based on the comprehensive score calculated by these parameters. When the score reaches the decision threshold ν, the user chooses to charge. If there is an idle charging pile, the EV starts charging directly, otherwise it waits in the waiting area. The decision function is: where r q represents the current occupancy rate of the waiting area of the charging station, p max Indicates the highest charging price that the user can accept. Charging stations are available on a first-come, first-served basis for waiting areas and assembly areas. T The vehicles in the station are charged, and the charging fee is collected after charging is completed and included in the total revenue of the charging station. Step 2: Markov decision process modeling. In the dynamic pricing problem of charging stations, the arrival of vehicles at the charging station in each time period and the charging station's execution of pricing actions can be regarded as a decision sequence. In this invention, such a pricing process is modeled as a Markov decision process (MDP), which consists of a four-tuple<S,A,R,η> Denotes, S denotes the state space, A denotes the action of the agent, R denotes the reward function, and η denotes the noise used for exploration. The elements of MDP, namely the state space, action space, reward function, and exploration noise, are defined as follows: Step 2.1: State. S represents the state space, and the state information s at each time step T ∈S includes the current electricity price of the charging station, the occupancy rate of the charging piles at the charging station, the occupancy rate of the waiting area, and the current time step information; in the environment, the state of each time step is recorded as a set in represents the occupancy rate of the waiting area at time step T, represents the usage rate of the charging pile at time step T. The environment accepts the Agent based on s at each time step. T The action made T To adjust the charging price p T , these actions will affect the state evolution in the future time step. Further define the state transition mode of the environment s T+1 =F(s T ,a T ), s T+1 is the system state of the next time step, and F is the state transfer function, which is specifically defined as: in is the number of charging piles in use, is the number of EVs in the waiting area. s T+1 The information in is updated as follows: Where N c is the total number of charging piles, N q The total number of parking spaces in the waiting area. Step 2.2: Action. A represents the action set. In state s T When the agent takes action a T ∈[-0.5, 0.5] represents the price adjustment method at each time step, a positive number indicates a price increase, and a negative number indicates a price decrease. Before the agent interacts with the environment each time, it first initializes the environment, transfers the dictionary, etc. The agent returns the state s fed back by the environment at each time step. T As input to the model Find the corresponding pricing action a through the policy network T and passed to the environment. The core goal of the agent is to determine a behavior strategy μ θ , the strategy guides the agent to different states s at each time step T Take the best action a T Finally, we find an optimal strategy μ θ * , aiming to maximize the cumulative discounted return throughout the process. That is: Where γ is the attenuation factor used to measure the importance of future returns, and 0≤γ<1, R T is the reward at T time steps. Step 2.3: Reward function. R represents the reward function in the process of interaction between the environment and the agent, that is, the target value. At each time step, when a vehicle is fully charged, the revenue will be included in the reward of that step. In the reward design of the environment, the present invention introduces a "delayed reward" mechanism, that is, the environment will take the revenue generated by the EV that arrives at the charging station in step T-1 after completing charging in step T as the reward R of step T. T This design takes into account the particularity of the charging station pricing strategy, that is, there is a certain time delay between the pricing of charging services and the actual payment of car owners. This reward structure helps the agent learn how to optimize long-term benefits instead of just pursuing immediate economic benefits. In addition, this design also simulates the common phenomenon of delayed benefits in real-world economic decision-making, increasing the practical applicability of the model. Therefore, the reward R T The calculation method is as follows: Step 2.4: Exploration noise. η represents random noise, and its value range is η∈[-0.5,0.5], and it will gradually decrease with the increase of training times. Since the DDPG algorithm adopts a deterministic strategy, its own exploration is still very limited, so it is necessary to introduce a random noise η in the behavior strategy to enhance the agent's exploration ability: a T =μ θ (Input T )+η Step 3: Build an experience generation model based on U-Net. The core is a structured U-Net neural network that enhances the diversity and representation of data by comprehensively utilizing temporal information and spatial features. The architecture of the model is shown in Figure 3. The present invention adopts the Consistency Training (CT) method to train the model. First, Gaussian noise is added to the input x: where t n For an earlier time point, t n+1 are later time points, all belonging to the same time point sequence, t i Generated by the following formula: Where ξ is used to make nonlinear changes to the time scale, N is the total number of generated discrete time points, and Τ is the maximum range of time discretization. Secondly, for t n To timecode: t emb =concat(sin(t n ·freq),cos(t n ·freq)) Where freq is a set of frequencies uniformly distributed in logarithmic space, the purpose of which is to convert time t n Converting to a form that can be processed by sine and cosine functions allows time information to be embedded in the data in a continuous periodic manner. Finally, t emb and Input to the feature extraction part of the model. Feature extraction mainly uses a module (DSC) composed of multi-layer convolution and nonlinear activation function to process data. The specific processing process is as follows: The first layer of feature extraction is the downsampling layer, which consists of a two-dimensional convolutional network and three DSCs. Downsampling can retain important features in the input data while filtering out redundant information. In addition, during the downsampling process, each layer will be temporally embedded: At the same time, residual connections are made to the data every other layer: As the network depth increases, these features may be difficult to reconstruct in the subsequent upsampling process, so in the downsampling layer, the model jumps to preserve certain key features. The second layer of feature extraction is the middle layer, which also uses DSC. The extraction of data features is then deepened through the middle layer, which is the core of information processing in the model and provides rich contextual information for the subsequent upsampling process. The third layer of feature extraction is the upsampling layer, which has a similar structure to the downsampling layer. The model needs to reconstruct details close to the original input data in the upsampling layer, so the features saved at the corresponding time point during the downsampling process are fused with the current features to ensure that there is both high-level abstract information and specific information from lower layers in the feature reconstruction process. The rest of the processing is basically the same as the downsampling layer. The final output layer of the model calculates the weights and Combining the original input and the features processed by the network, the produced data is modified to enhance the details and quality of the model output. The process is as follows: where x ori is the original input of the model. The model parameters are fitted by minimizing the Loss function, which is defined as: Where λ is used to assign different importance to different time steps. are the weights for the EMA version of the model. When using the trained model to generate experience, in order to avoid large errors in the generated data, the present invention chooses the 5-step sampling method and abandons the faster 1-step sampling. The specific sampling process is shown in (26): That is, first add noise τ to the given x n Steps to get pass Get the output, and then add noise τ to the output n Steps to get and enter Executing the above operation five times in a loop is called five-step sampling, which can reduce the error of generated data. Step 4: Constructing a feature generation model based on SimSiam. The present invention constructs a feature generation model based on SimSiam, the purpose of which is to provide effective feature representation for subsequent clustering operations through an unsupervised learning method, and its structure is shown in FIG4 . The training method of the model in the present invention is: y masked =y noised ⊙(1-M),M~Bernoulli(mask_prob) First, data enhancement is performed on the input experience sample y to obtain two perturbed versions. is a normally distributed random variable with mean 0 and standard deviation noise_level. I is the identity matrix, indicating that the noise is independent and identically distributed. The element M is a Bernoulli random variable that takes the value 1 with probability mask_prob and takes the value 0 with probability (1-mask_prob). Then the two perturbed versions of y masked1 and masked2 Input to the same Encoder for feature extraction, and get two different vectors k1, k2. Use a prediction network to predict the features of k2 from k1, and predict the features of k1 from k2, and get feature vectors o1, o2 respectively. Finally, calculate the symmetric loss (cosine similarity) of the two prediction results. The symmetric loss ensures that the network can not only accurately predict the features of one experience from the features of another experience, but also have the same effect in reverse. Its loss function is defined as: Stopgrad is a "stop gradient" technique, which aims to prevent the model from falling into a degenerate solution (i.e., the feature collapses to a constant) and further improve the stability of learning. D is the cosine similarity, and the calculation formula is: After saving the trained model parameters, the agent inputs y into the feature generation model to represent its features: {o1,o2,...,o w }={f s (y1),f s (y2),...,f s (y w )} And record all the features as a set O = {o1, o2, ..., ow}, feature o i The corresponding experience index is stored in the experience pool for subsequent clustering. Step 5: Construct an experience replay pool based on clustering balanced sampling. In order to further improve the sample utilization efficiency and training effect, after the Agent completes the above sample amplification operation, it will use the DBSCAN algorithm to cluster the experience samples based on set O. The clustering process is as follows: For any feature o∈O of an empirical sample, its ε neighborhood is first determined by the following method: Y ε (o)={j∈O|dist(o,j)≤ε} Where dist(o,j) represents the distance between o and j. If the ε neighborhood of o contains at least MinPts points, that is, |Y ε (o)|≥MinPts,|Y ε (o)| is the number of data points in the ε neighborhood of o, then mark the point as a core point. Then create a new cluster and mark all points in o and its neighborhood as belonging to the same cluster. Traverse each point in the neighborhood, and if there are other core points, mark all points in its neighborhood as belonging to the same cluster. For other sample points other than core points, they are defined as boundary points and noise points respectively by the following formulas: |Y ε (o)|<MinPts and |Y ε (o)|<MinPts andój∈O|o∈|Y ε (j)| Starting from any unmarked point, repeat the above steps until all points are marked as visited and classified into clusters or marked as noise points. In addition, the present invention proposes CB Sampling to sample empirical samples, that is, before each sampling, the number of samples to be extracted from each cluster is calculated: in is the rounding down symbol, B is the total number of samples to be extracted, and K is the number of clusters after clustering, which ensures that at least one sample is selected in each cluster. After randomly sampling in each cluster according to H, if the final number of samples is insufficient, samples are randomly supplemented from the entire experience pool until the required number of samples is reached. This sampling strategy aims to balance the frequency of occurrence of various types of samples in model training, thereby avoiding model bias caused by too many samples of certain categories. Through targeted sample utilization, the model's responsiveness and adaptability to key states are enhanced. At the same time, the Agent will regularly update and cluster new experience samples that are subsequently stored in the experience pool. Step 6: Construct a reinforcement learning training framework based on dual-value deep deterministic policy gradient. In order to make the model training process as stable as possible, the present invention constructs a dual-value network to reduce the estimation error, and its structure is shown in Figure 5. The agent that completes all the above operations will update the parameters of the policy network and the value network at each time step, and the update includes the following process. After the agent completes the interaction with the environment at the current time step, it takes out the experience samples for training through CB Sampling. Since there are two Critic networks, the state s in these experience samples is estimated by the following formula: T+1 Take action a T+1 The value of: Then, the temporal difference target of the empirical sample is calculated based on the estimate T , the calculation formula is as follows: target T =R T +γmin(Q1(s T+1 ,a T+1 ),Q2(s T+1 ,a T+1 )) Then according to target T Calculate the Loss values of the two networks separately: The gradient calculation formula of the value network is as follows: To maximize the reward, the loss function of the policy network is defined as: in To calculate the target T The value network that takes the minimum value when . The policy gradient calculation formula is as follows: In addition, the target network adopts a soft update method, that is, the target network is updated slowly and gradually approaches the Critic network and the Actor network. The formula is as follows: i - ←τθ+(1-τ)θ - Usually τ is a relatively small parameter. When τ = 1, it is equivalent to directly copying the critic network parameters to the target network. The target network also uses this soft update method.
