A model training method, a transport capacity allocation method, and a device

By training models of generators and discriminators and using historical data to predict delivery capacity demand in delivery areas, the problem of insufficient delivery capacity in food delivery areas has been solved, enabling accurate capacity allocation and timely processing of user orders.

CN114861992BActive Publication Date: 2025-11-28NANJING UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210408938.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-19
Publication Date
2025-11-28
Estimated Expiration
2042-04-19

AI Technical Summary

Technical Problem

In existing technologies, the allocation of delivery capacity in food delivery areas cannot accurately predict future demand, resulting in insufficient delivery capacity in some areas and frequent instances of user orders being delayed.

Method used

By training models with generators and discriminators, historical data is used to predict the transportation capacity demand in delivery areas. Training samples are constructed and reward values ​​are adjusted to maximize the reward value for training the generator, ensuring the accuracy of the predicted transportation capacity data.

Benefits of technology

It improved the accuracy of delivery capacity forecasting, avoided order delays for users, and achieved reasonable capacity allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114861992B_ABST
    Figure CN114861992B_ABST
Patent Text Reader

Abstract

The specification discloses a model training method, a transport capacity allocation method and device. First, historical data is obtained. Second, the historical data is input into a to-be-trained generator to predict transport capacity data of a delivery transport capacity in a delivery area at a specified time as predicted transport capacity data. Then, a first training sample is constructed according to the predicted transport capacity data and region condition data corresponding to the delivery area at the specified time. Then, the first training sample is input into a preset discriminator to determine a confidence degree of the first training sample belonging to real data and a reward value corresponding to the first training sample. Finally, the generator is trained to maximize the reward value corresponding to the first training sample. The method can determine the reward value corresponding to the first training sample based on the confidence degree of the first training sample belonging to real data determined by the discriminator, train the generator, and make the generator determine more accurate predicted transport capacity data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of computer, and particularly relates to a model training method, a transport capacity allocation method and device. BACKGROUND

[0002] With the rapid development of society, the take-out industry is becoming more and more developed, and more and more people choose to order by take-out. Because the number of user orders in different areas in the city is different, if the delivery capacity in each delivery area cannot be reasonably allocated, there may be insufficient delivery capacity in some delivery areas, resulting in some user orders in the delivery area being unattended, and thus the user order is overdue.

[0003] At present, the delivery capacity of each delivery area is usually allocated by manual allocation method, but the manual allocation method cannot well estimate the required delivery capacity of each delivery area in the future period of time, so that the user order is overdue due to unreasonable allocation of delivery capacity in each delivery area.

[0004] Therefore, how to reasonably allocate the delivery capacity of each delivery area is a problem to be solved. SUMMARY

[0005] The present specification provides a model training method, device, storage medium and electronic equipment to partially solve the above problems existing in the prior art.

[0006] The present specification adopts the following technical solutions:

[0007] The present specification provides a model training method, comprising:

[0008] Obtain historical data, the historical data containing historical regional condition data corresponding to a delivery area and historical delivery capacity data of the delivery capacity in the delivery area;

[0009] Input the historical data into a generator to be trained to predict the delivery capacity data of the delivery capacity in the delivery area at a specified time as predicted delivery capacity data;

[0010] According to the predicted delivery capacity data and the regional condition data corresponding to the delivery area at a specified time determined by the delivery capacity data, a first training sample is constructed;

[0011] Input the first training sample into a predetermined discriminator to determine the confidence of the first training sample belonging to real data, and determine the reward value corresponding to the first training sample according to the confidence corresponding to the first training sample;

[0012] maximize a reward value corresponding to the first training sample, wherein the generator is used to predict the required transport data when allocating transport capacity.

[0013] Optionally, the reward value corresponding to the first training sample is determined according to a confidence level corresponding to the first training sample, and specifically includes:

[0014] The base reward value corresponding to the first training sample is determined according to a confidence level corresponding to the first training sample.

[0015] The reward value corresponding to the first training sample is determined according to the base reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator.

[0016] Optionally, the region status data includes resource rewards of the delivery transport capacity.

[0017] The penalty value corresponding to the first training sample is determined by the generator, and specifically includes:

[0018] The resource rewards of the delivery transport capacity in the region status data corresponding to the historically delivered region in the first training sample are changed to determine a changed first training sample.

[0019] The changed first training sample is input into the generator to be trained to predict predicted transport data corresponding to the changed first training sample.

[0020] The penalty value corresponding to the first training sample is determined according to the predicted transport data corresponding to the first training sample and the predicted transport data corresponding to the changed first training sample.

[0021] Optionally, the reward value corresponding to the first training sample is determined according to the base reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator, and specifically includes:

[0022] If the penalty value corresponding to the first training sample is less than a set penalty value, the reward value corresponding to the first training sample is determined according to the base reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator.

[0023] If the penalty value corresponding to the first training sample is not less than the set penalty value, the base reward value corresponding to the first training sample is taken as the reward value corresponding to the first training sample.

[0024] Optionally, the generator is trained to maximize the reward value corresponding to the first training sample, and specifically includes:

[0025] training the generator and the discriminator with an optimization objective of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample.

[0026] Optionally, before training the generator and the discriminator with an optimization objective of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample, the method further comprises:

[0027] obtaining a second training sample, the second training sample containing real regional condition data corresponding to a delivery area at a specified time and real capacity data of delivery capacity in the delivery area at the specified time;

[0028] inputting the first training sample and the second training sample into the discriminator to be trained to determine the confidence of the first training sample belonging to real data and the confidence of the second training sample belonging to real data;

[0029] training the generator and the discriminator with an optimization objective of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample, specifically comprising:

[0030] training the generator and the discriminator with an optimization objective of maximizing the reward value corresponding to the first training sample, minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample, and minimizing the deviation between the confidence corresponding to the second training sample and the label corresponding to the second training sample.

[0031] The specification provides a method for capacity allocation, comprising:

[0032] obtaining regional condition data corresponding to a target delivery area;

[0033] inputting the regional condition data corresponding to the target delivery area into the generator to predict capacity data of delivery capacity in the target delivery area, the generator being trained by the method for model training described above;

[0034] allocating capacity according to the capacity data of delivery capacity in the target delivery area.

[0035] The specification provides a device for model training, comprising:

[0036] The acquisition module is configured to acquire historical data, the historical data including historical regional condition data corresponding to a delivery area and historical capacity data of a delivery capacity in the delivery area;

[0037] The prediction module is configured to input the historical data into a generator to be trained to predict capacity data of the delivery capacity in the delivery area at a specified time as predicted capacity data.

[0038] The construction module is configured to construct a first training sample according to the predicted capacity data and regional condition data corresponding to the delivery area at the specified time determined by the capacity data.

[0039] The input module is configured to input the first training sample into a preset discriminator to determine a confidence degree of the first training sample belonging to real data and determine a reward value corresponding to the first training sample according to a confidence degree corresponding to the first training sample.

[0040] The training module is configured to train the generator by maximizing the reward value corresponding to the first training sample, wherein the generator is configured to predict capacity data required when allocating the delivery capacity.

[0041] The present specification provides an apparatus for capacity allocation, comprising:

[0042] The acquisition module is configured to acquire regional condition data corresponding to a target delivery area.

[0043] The input module is configured to input the regional condition data corresponding to the target delivery area into a generator to predict capacity data of a delivery capacity in the target delivery area, the generator being trained by the method for model training.

[0044] The allocation module is configured to allocate the capacity according to the capacity data of the delivery capacity in the target delivery area.

[0045] The present specification provides a computer-readable storage medium, the storage medium storing a computer program, the computer program being executed by a processor to implement the method for model training or the method for capacity allocation.

[0046] The present specification provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method for model training or the method for capacity allocation when executing the program.

[0047] The above at least one technical solution adopted by the present specification can achieve the following beneficial effects:

[0048] In the model training method provided in the specification, historical data is obtained, and the historical data includes historical regional condition data corresponding to a delivery area and historical capacity data of a delivery capacity in the delivery area. Secondly, the historical data is input into a generator to be trained to predict capacity data of the delivery capacity in the delivery area at a specified time, as predicted capacity data. Then, according to the predicted capacity data and the regional condition data corresponding to the delivery area at the specified time determined by the capacity data, a first training sample is constructed. Then, the first training sample is input into a predetermined discriminator to determine the confidence of the first training sample belonging to real data, and the reward value corresponding to the first training sample is determined according to the confidence corresponding to the first training sample. Finally, the generator is trained to maximize the reward value corresponding to the first training sample, wherein the generator is used to predict the capacity data required when the delivery capacity is allocated.

[0049] From the above-mentioned model training method, it can be seen that the first training sample is constructed according to the predicted capacity data determined by the generator and the regional condition data corresponding to the delivery area at the specified time determined by the capacity data. The first training sample is input into a predetermined discriminator to determine the confidence of the first training sample belonging to real data. The reward value corresponding to the first training sample is obtained based on the confidence of the first training sample belonging to real data determined by the discriminator, and the generator is trained to make the generator determine more accurate predicted capacity data. BRIEF DESCRIPTION OF DRAWINGS

[0050] The drawings described herein are used to provide further understanding of the specification, and form a part of the specification. The illustrative embodiments of the specification and their descriptions are used to explain the specification, and do not constitute an improper limitation on the specification. In the drawings:

[0051] Figure 1 A flowchart of the model training method provided for the embodiments of the specification;

[0052] Figure 2 A schematic diagram of a model structure provided for the embodiments of the specification;

[0053] Figure 3 A flowchart of the capacity allocation method provided for the embodiments of the specification;

[0054] Figure 4 A structural schematic diagram of the model training device provided for the embodiments of the specification;

[0055] Figure 5 A structural schematic diagram of the capacity allocation device provided for the embodiments of the specification;

[0056] Figure 6A structural schematic diagram of an electronic device provided in an embodiment of the present specification. DETAILED DESCRIPTION

[0057] For the purpose, technical solutions and advantages of the present specification to be clearer, the technical solutions of the present specification will be described clearly and completely in conjunction with the specific embodiments of the present specification and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present specification, rather than all the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the scope of protection of the present specification.

[0058] The technical solutions provided in the embodiments of the present specification will be described in detail below in conjunction with the drawings.

[0059] In the embodiments of the present specification, the generator and the discriminator are contained in the process of model training. The generator and the discriminator can be trained based on the generative adversarial network (GAN). Ideally, when the model training is completed, the prediction accuracy of the discriminator is 50%, which means that the training samples constructed by the generator are close to the real data. The process of how to train the generator and the discriminator will be introduced first, as shown in the following. Figure 1

[0060] Figure 1 The flowchart of the method of model training provided in the embodiments of the present specification specifically includes the following steps:

[0061] S100: Obtain historical data, which contains the regional condition data corresponding to the delivery area in history and the capacity data of the delivery capacity in the delivery area in history.

[0062] In the embodiments of the present specification, the execution subject of the method of model training provided in the present specification can be a server, or an electronic device such as a desktop computer. For the convenience of description, the method of model training provided in the present specification will be described below by taking the server as the execution subject.

[0063] In the embodiments of the present specification, the server can obtain historical data, which contains the regional condition data corresponding to the delivery area in history and the capacity data of the delivery capacity in the delivery area in history.

[0064] ​The server can sort the historical area status data corresponding to the historical delivery area and the capacity data of the delivery capacity in the historical delivery area in chronological order, and select the historical area status data corresponding to the historical delivery area and the capacity data of the delivery capacity in the historical delivery area in a period of time as historical data based on a pre-set time window.

[0065] For example, the server can select the historical area status data corresponding to the historical delivery area and the capacity data of the delivery capacity in the historical delivery area in any time period as historical data. The specific formula is as follows:

[0066] O = (S t , A t , S t+1 , A t+1 , …, S t+H , A t+H )

[0067] In the above formula, S t may be used to represent the area status data corresponding to the delivery area at time t. A t may be used to represent the capacity data of the delivery capacity in the delivery area at time t. H may be used to represent the length of the historical data.

[0068] In the embodiments of the present specification, the capacity data of the delivery capacity in the delivery area can refer to the number of personnel or the number of mechanical equipment undertaking the delivery work. For example, the number of delivery riders, the number of unmanned devices, etc. The capacity data of the delivery capacity in the delivery area can also refer to the order acceptance rate. For example, five-minute order acceptance rate, ten-minute order acceptance rate, etc. The area status data includes: static area status data, dynamic area status data, auxiliary area status data, and resource reward of the delivery capacity.

[0069] The static area status data mentioned here can be used to represent the area status data that is not affected by the predicted capacity data of the delivery capacity in the delivery area. For example, weather data (e.g., weather type, temperature, humidity, etc.), date data (e.g., weekday, holiday, week, etc.), rider data (e.g., age, gender, part-time full-time, etc.), city data (e.g., mean and variance of the number of orders in the city in the recent period, mean and variance of the delivery distance of orders in the city in the recent period, etc.), current delivery area data (e.g., mean and variance of the number of orders in the delivery area in the recent period, mean and variance of the delivery distance of orders in the delivery area in the recent period, etc.), etc.

[0070] The rider data can be the distribution of the rider data in the delivery area in a set time period. For example, the age distribution and gender distribution of the riders in the delivery area.

[0071] The dynamic area situation data mentioned herein can be used to represent the area situation data that will be affected by the capacity data of the predicted delivery capacity in the delivery area. This part of the dynamic area situation data will be adjusted by the capacity data of the predicted delivery capacity in the delivery area generated by the generator. For example, the average number of users in the delivery area for a certain number of days, the average order duration per user in the delivery area for a certain number of days, and the order acceptance rate in the delivery area for a certain number of days.

[0072] The auxiliary area situation data mentioned herein can be used to represent the area situation data that assists in determining the dynamic area situation data, such as the number of daily orders in the delivery area for a certain number of days and the number of daily users in the delivery area for a certain number of days.

[0073] The resource reward of the delivery capacity mentioned herein can refer to the resource reward obtained after the delivery is completed. Since the resource reward is stable in the long term, the historical resource reward can be directly used as the resource reward at a specified time.

[0074] S102: inputting the historical data into the generator to be trained to predict the capacity data of the delivery capacity in the delivery area at a specified time as predicted capacity data.

[0075] S104: constructing a first training sample according to the predicted capacity data and the area situation data corresponding to the delivery area at a specified time determined by the capacity data.

[0076] In actual applications, different delivery areas correspond to different area situation data, which will result in different capacity data of the delivery capacity required by each delivery area. If the estimated capacity data of the delivery capacity required by the delivery area in the future period of time is inaccurate, it may result in no one to pick up the user order, and the user order may be overdue. Based on this, the server can predict the capacity data of the delivery capacity in the delivery area through the area situation data corresponding to the delivery area in the history.

[0077] In the embodiments of the present specification, the server can input the historical data into the generator to be trained to predict the capacity data of the delivery capacity in the delivery area at a specified time as predicted capacity data.

[0078] Specifically, the server can input the historical data into the generator to be trained, predict the capacity data of the delivery capacity in the delivery area at a specified time as predicted capacity data according to the area situation data corresponding to the delivery area in the history.

[0079] Further, the server can input the historical data into the to-be-trained generator, and predict the capacity data of the delivery capacity in the delivery area at the specified time according to the static area condition data, the dynamic area condition data corresponding to the delivery area in history, and the resource reward of the delivery capacity, as the predicted capacity data.

[0080] In the embodiments of the present specification, the server can construct the first training sample according to the predicted capacity data and the area condition data corresponding to the delivery area at the specified time determined by the capacity data

[0081] Specifically, the server can input the area condition data corresponding to the delivery area in history and the capacity data of the delivery capacity in the delivery area at the specified time into the pre-set area condition transfer function, and determine the area condition data corresponding to the delivery area at the specified time by the capacity data.

[0082] In the embodiments of the present specification, the area condition data includes: static area condition data, dynamic area condition data, auxiliary area condition data, and resource reward of the delivery capacity. The server can determine the auxiliary area condition data corresponding to the delivery area at the specified time according to the auxiliary area condition data corresponding to the delivery area in history and the capacity data of the delivery capacity in the delivery area at the specified time.

[0083] Among them, the server can determine the dynamic area condition data and the auxiliary area condition data corresponding to the delivery area at the specified time according to the rotation rule of the time window. For example, the auxiliary area condition data contains the capacity data of the delivery capacity in the delivery area every day for seven days. If the auxiliary area condition data corresponding to the delivery area at the specified time is determined, the capacity data of the delivery capacity at the earliest time in the auxiliary area condition data is deleted, and the capacity data of the delivery capacity in the delivery area at the specified time is added as the auxiliary area condition data corresponding to the delivery area at the specified time.

[0084] Secondly, the server can determine the dynamic area condition data corresponding to the delivery area at the specified time according to the auxiliary area condition data corresponding to the delivery area at the specified time.

[0085] Then, since the resource reward of the delivery capacity is long-term stable, the server can take the resource reward of the delivery capacity in history as the resource reward of the delivery capacity corresponding to the delivery area at the specified time. Moreover, since the static area condition data will not be affected by the predicted capacity data of the delivery capacity in the delivery area. The server can determine the static area condition data corresponding to the delivery area at the specified time from the historical data.

[0086] Finally, the server can deliver the auxiliary area condition data corresponding to the delivery area at the specified time, the dynamic area condition data corresponding to the delivery area at the specified time, the static area condition data corresponding to the delivery area at the specified time, and the resource reward of the delivery capacity, as the area condition data corresponding to the delivery area at the specified time.

[0087] Further, the server can also construct the first training sample according to the historical area condition data corresponding to the delivery area, the predicted capacity data, and the area condition data corresponding to the delivery area at the specified time determined by the capacity data.

[0088] S106: input the first training sample into the preset discriminator, determine the confidence that the first training sample belongs to the real data, and determine the reward value corresponding to the first training sample according to the confidence corresponding to the first training sample.

[0089] In the embodiments of the present specification, the server can input the first training sample into the preset discriminator, and determine the confidence that the first training sample belongs to the real data. If the first training sample belongs to the real data, the confidence that the first training sample belongs to the real data determined by the discriminator is 1, and if the first training sample does not belong to the real data, the confidence that the first training sample belongs to the real data determined by the discriminator is 0.

[0090] Then, the server can determine the reward value corresponding to the first training sample according to the confidence corresponding to the first training sample. Wherein, the greater the similarity between the constructed first training sample and the real data, the greater the confidence, and the greater the reward value. The smaller the similarity between the constructed first training sample and the real data, the smaller the confidence, and the smaller the reward value.

[0091] In actual application, the method of model training usually introduces functions (sigmoid, tanh) to introduce prior assumptions. However, the curve properties of the functions introduced by this method are fixed, and the prior assumption introduced is that the higher the average resource reward of the resource reward of the delivery capacity in a delivery area, the higher the capacity data of the delivery capacity in the delivery area. However, the resource reward of the delivery capacity is determined by multiple factors, such as delivery distance, delivery difficulty, etc. Therefore, this method cannot meet the actual demand, and may lead to the trained generator being unable to obtain more accurate prediction results. Based on this, the server can adjust the reward value corresponding to the first training sample through the penalty value corresponding to the first training sample determined by the generator, avoid directly introducing prior assumptions, and make the generator determine more accurate prediction results.

[0092] In the embodiments of the present disclosure, the server can determine the basic reward value corresponding to the first training sample according to the confidence corresponding to the first training sample. The specific formula is as follows:

[0093] r t =log D(S t ,A t+1 ,S t+1 )

[0094] In the above formula, S t may be used to represent the region status data corresponding to the delivery area at time t. A t may be used to represent the capacity data of the delivery capacity in the delivery area at time t+1. S t+1 may be used to represent the region status data corresponding to the delivery area at time t+1. D() may be used to represent the discriminator, if the first training sample belongs to the real data, the confidence of the first training sample determined by the discriminator to belong to the real data is 1, if the first training sample does not belong to the real data, the confidence of the first training sample determined by the discriminator to belong to the real data is 0.

[0095] In the embodiments of the present disclosure, the server can change the resource reward of the delivery capacity in the region status data corresponding to the historical delivery area in the first training sample, and determine the changed first training sample.

[0096] Specifically, the server can change the resource reward of the delivery capacity in the region status data corresponding to the historical delivery area in the first training sample by randomly selected Gaussian noise, and determine the changed first training sample. The specific formula is as follows:

[0097] a=a c +N(0,σ 2 )

[0098] In the above formula, a c may be used to represent the resource reward of the delivery capacity in the region status data corresponding to the historical delivery area in the first training sample. N(0, σ 2 ) may be used to represent Gaussian noise. a may be used to represent the changed resource reward of the delivery capacity in the region status data corresponding to the delivery area in the first training sample.

[0099] Then, the server can determine the penalty value corresponding to the first training sample according to the predicted capacity data corresponding to the first training sample and the predicted capacity data corresponding to the changed first training sample.

[0100] In the embodiments of the present specification, the predicted delivery capacity predicted by the generator needs to meet the condition that the resource reward of the delivery capacity is high, the predicted delivery capacity data is not reduced, and the resource reward of the delivery capacity is low, and the predicted delivery capacity data is not increased.

[0101] Based on this, the server can determine the penalty value corresponding to the first training sample based on the predicted delivery capacity corresponding to the first training sample, the predicted delivery capacity corresponding to the first training sample after the change, the resource reward of the delivery capacity in the historical region status data corresponding to the delivery region in the first training sample, and the resource reward of the changed delivery capacity in the region status data corresponding to the delivery region in the first training sample. The specific formula is as follows:

[0102] r p = β (y - y ∈ ) (a - a c )

[0103] In the above formula, r p may be used to represent the penalty value corresponding to the first training sample. β may be used to represent a proportion coefficient with a value greater than 0, which can be adjusted through expert experience during the model training process. y may be used to represent the predicted delivery capacity corresponding to the first training sample. y ∈ may be used to represent the predicted delivery capacity corresponding to the first training sample after the change. a may be used to represent the resource reward of the delivery capacity in the historical region status data corresponding to the delivery region in the first training sample. a c may be used to represent the resource reward of the changed delivery capacity in the region status data corresponding to the delivery region in the first training sample. It can be seen that a-a c may be used to represent the difference between the resource reward of the delivery capacity in the historical region status data corresponding to the delivery region in the first training sample and the resource reward of the changed delivery capacity in the region status data corresponding to the delivery region in the first training sample, that is, the randomly selected Gaussian noise. If r p is greater than 0, it means that the generator has learned the correct correlation and does not need to be adjusted additionally. If r p is less than 0, it means that the generator has learned the wrong correlation.

[0104] In the embodiments of the present specification, the server can determine the reward value corresponding to the first training sample according to the basic reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator. The specific formula is as follows:

[0105] r = r t + r p

[0106] In the above formula, r tThe reward value corresponding to the first training sample can be represented by r. p The penalty value corresponding to the first training sample can be represented by r. The reward value corresponding to the first training sample can be represented by r.

[0107] Further, the server can determine a sum value of the reward values corresponding to the confidence degrees of the data at each time point in the first training sample belonging to the real data according to the confidence degrees of the data at each time point in the first training sample belonging to the real data. The specific formula is as follows:

[0108]

[0109] In the above formula, H can be used to represent the sample length of the first training sample. i The reward value corresponding to the i-th time point of the first training sample can be represented by r.

[0110] In actual application, if the penalty value corresponding to the first training sample is less than a set penalty value, it is considered that the first training sample constructed has a larger error, and the penalty value is added to the reward value. If the penalty value corresponding to the first training sample is not less than the set penalty value, it is considered that the error generated by the first training sample constructed is smaller, and the penalty value is not added to the reward value.

[0111] In the embodiment of the present specification, if the penalty value corresponding to the first training sample is less than a set penalty value, the reward value corresponding to the first training sample is determined according to the basic reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator.

[0112] If the penalty value corresponding to the first training sample is not less than the set penalty value, the basic reward value corresponding to the first training sample is taken as the reward value corresponding to the first training sample.

[0113] S108: training the generator for maximizing the reward value corresponding to the first training sample, wherein the generator is used to predict the required capacity data when allocating the delivery capacity.

[0114] In the embodiment of the present specification, the server can train the generator for maximizing the reward value corresponding to the first training sample, wherein the generator is used to predict the required capacity data when allocating the delivery capacity.

[0115] In the process of model training, the server not only needs to train the generator, but also needs to train the discriminator. The first training sample constructed by the generator is used to train the discriminator, so that the confidence degree of the discriminator determining that the first training sample belongs to the real data is more accurate. The confidence degree of the first training sample belonging to the real data determined by the discriminator is used to train the generator, so that the first training sample constructed by the generator is closer to the real data.

[0116] In the embodiments of the present specification, the server can train the generator and the discriminator with the optimization objective of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample.

[0117] Further, the server can obtain a second training sample, where the second training sample contains real regional condition data corresponding to the delivery area at a specified time and real delivery capacity data of delivery capacity in the delivery area at the specified time.

[0118] Secondly, the server can input the first training sample and the second training sample into the discriminator to be trained to determine the confidence of the first training sample belonging to real data and the confidence of the second training sample belonging to real data.

[0119] Finally, the server can train the generator and the discriminator with the optimization objective of maximizing the reward value corresponding to the first training sample, minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample, and minimizing the deviation between the confidence corresponding to the second training sample and the label corresponding to the second training sample. The specific formula is as follows:

[0120]

[0121] In the above formula, if the training sample is the second training sample, the second training sample is input into to determine the loss corresponding to the confidence of the second training sample belonging to real data. If the training sample is the first training sample, the first training sample is input into to determine the loss corresponding to the confidence of the first training sample belonging to real data.

[0122] The above-mentioned generator can be a model obtained by a proximal policy optimization algorithm (Proximal Policy Optimization, PPO), a policy gradient algorithm (Policy Graident, PG), etc. The present specification does not limit the specific form of the decision model.

[0123] If the proximal policy optimization algorithm (Proximal Policy Optimization, PPO) is applied, the specific formula can be as follows:

[0124] J=E t [min(wA t ,clip(w,1-ε,1+ε)A t )]

[0125] Wherein, E t[min(, )] is used to represent the minimum value selected from two numerical values. ε is used to represent a hyperparameter that limits the model parameter update amplitude of the generator. clip(w, 1-ε, 1+ε) is used to represent the limitation of the model parameter update amplitude of the generator. t is used to represent the reward value corresponding to the first training sample. w can be used to represent the ratio of the model parameters of the generator in this round of training to the model parameters of the generator in the last round of training.

[0126] For example, the preset hyperparameter is 0.2, and the preset limitation of the model parameter update amplitude of the generator is 0.8 to 1.2. If the model parameter update amplitude is greater than 1.2, the model parameter update amplitude is determined as 1.2. If the model parameter update amplitude is less than 0.8, the model parameter update amplitude is determined as 0.8.

[0127] As can be seen from the formula, the server can select the smaller reward value from the two and adjust and optimize the model parameters contained in the generator to make the generator find the delivery capacity data of the delivery capacity in the delivery area as close to the real training sample as possible, so as to imitate the delivery capacity data of the delivery capacity in the delivery area in the actual environment.

[0128] Figure 2 A schematic diagram of a model structure provided by an embodiment of the present specification.

[0129] In Figure 2 , the server can input the first training sample and the second training sample into the discriminator to train the discriminator, and determine the reward value corresponding to the first training sample and the reward value corresponding to the second training sample according to the confidence that the first training sample belongs to real data and the confidence that the second training sample belongs to real data determined by the discriminator, to train the generator.

[0130] In the embodiment of the present specification, the server can take the maximum reward value as the optimization target, and train the generator by adjusting and optimizing the model parameters contained in the generator. That is, through multiple rounds of iterative training, the reward value can be continuously increased and converged in a numerical range, thereby completing the training process of the generator.

[0131] Of course, in addition to taking the maximum reward value as the optimization target to train the generator, the prediction accuracy of the discriminator can also be determined. If the prediction accuracy of the discriminator meets the set range, the training of the generator and the discriminator is completed.

[0132] From the above process, it can be seen that the method can construct a first training sample according to the predicted transport capacity data determined by the generator and the region condition data corresponding to the distribution region at a specified time determined by the transport capacity data. The first training sample is input into a predetermined discriminator to determine the confidence of the first training sample belonging to real data. The reward value corresponding to the first training sample is obtained based on the confidence of the first training sample belonging to real data determined by the discriminator, and the generator is trained so that the generator determines more accurate predicted transport capacity data.

[0133] After the generator is trained, the embodiment of the present specification can perform transport capacity allocation through the trained generator, as shown in Figure 3

[0134] Figure 3 The flowchart of the method of transport capacity allocation provided by the embodiment of the present specification specifically includes:

[0135] S300: Obtain region condition data corresponding to a target distribution region.

[0136] S302: Input the region condition data corresponding to the target distribution region into the generator to predict transport capacity data of distribution transport capacity in the target distribution region, wherein the generator is trained by the above model training method.

[0137] S304: Perform transport capacity allocation according to the transport capacity data of the distribution transport capacity in the target distribution region.

[0138] In the embodiment of the present specification, the server can obtain region condition data corresponding to a target distribution region. Secondly, the server can input the region condition data corresponding to the target distribution region into the generator to predict transport capacity data of distribution transport capacity in the target distribution region. Finally, the server can perform transport capacity allocation according to the transport capacity data of the distribution transport capacity in the target distribution region.

[0139] It should be noted that the server can display the transport capacity data of the distribution transport capacity in the target distribution region to the user for transport capacity allocation.

[0140] The above is the method of model training provided by one or more embodiments of the present specification. Based on the same idea, the present specification also provides a corresponding model training device, as shown in Figure 4

[0141] Figure 4 The structure diagram of the model training device provided by the embodiment of the present specification specifically includes:

[0142] ​​The acquisition module 400 is configured to acquire historical data, wherein the historical data comprises historical regional condition data corresponding to a delivery area and historical capacity data of a delivery capacity in the delivery area.

[0143] The prediction module 402 is configured to input the historical data into a generator to be trained to predict capacity data of the delivery capacity in the delivery area at a specified time as predicted capacity data.

[0144] The construction module 404 is configured to construct a first training sample according to the predicted capacity data and regional condition data corresponding to the delivery area at the specified time determined by the capacity data.

[0145] The input module 406 is configured to input the first training sample into a predetermined discriminator to determine a confidence degree of the first training sample belonging to real data, and determine a reward value corresponding to the first training sample according to the confidence degree corresponding to the first training sample.

[0146] The training module 408 is configured to train the generator by maximizing the reward value corresponding to the first training sample, wherein the generator is used to predict capacity data required when allocating a delivery capacity.

[0147] Optionally, the input module 406 is specifically configured to determine a basic reward value corresponding to the first training sample according to the confidence degree corresponding to the first training sample, and determine the reward value corresponding to the first training sample according to the basic reward value corresponding to the first training sample and a penalty value corresponding to the first training sample determined by the generator.

[0148] Optionally, the regional condition data comprises a resource reward of the delivery capacity.

[0149] The input module 406 is specifically configured to change the resource reward of the delivery capacity in the historical regional condition data corresponding to the delivery area in the first training sample, determine a changed first training sample, input the changed first training sample into the generator to be trained to predict predicted capacity data corresponding to the changed first training sample, and determine the penalty value corresponding to the first training sample according to the predicted capacity data corresponding to the first training sample and the predicted capacity data corresponding to the changed first training sample.

[0150] Optionally, the input module 406 is specifically configured to: if the penalty value corresponding to the first training sample is less than a set penalty value, determine the reward value corresponding to the first training sample according to the basic reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator; and if the penalty value corresponding to the first training sample is not less than the set penalty value, take the basic reward value corresponding to the first training sample as the reward value corresponding to the first training sample.

[0151] Optionally, the training module 408 is specifically configured to train the generator and the discriminator with the optimization target of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample.

[0152] Optionally, the training module 408 is specifically configured to: obtain a second training sample, the second training sample containing real regional condition data corresponding to a delivery area at a specified time and real power data of a delivery power in the delivery area at the specified time; input the first training sample and the second training sample into the discriminator to be trained to determine the confidence of the first training sample belonging to real data and the confidence of the second training sample belonging to real data; and train the generator and the discriminator with the optimization target of maximizing the reward value corresponding to the first training sample, minimizing the deviation between the confidence corresponding to the first training sample and the label corresponding to the first training sample, and minimizing the deviation between the confidence corresponding to the second training sample and the label corresponding to the second training sample.

[0153] Figure 5 The structure diagram of the device for delivery power allocation provided by the embodiments of the present application specifically includes:

[0154] The obtaining module 500 is configured to obtain regional condition data corresponding to a target delivery area.

[0155] The input module 502 is configured to input the regional condition data corresponding to the target delivery area into a generator to predict power data of a delivery power in the target delivery area, the generator being trained by the method for model training.

[0156] The distribution module 504 is configured to perform power distribution according to the power data of the delivery power in the target delivery area.

[0157] The present application also provides a computer readable storage medium storing a computer program, the computer program being used to execute the above-mentioned Figure 1 The model training method or the above-mentioned Figure 3 The power distribution method provided by the present application.

[0158] The specification also provides Figure 6 The structure diagram of the electronic device is shown. As Figure 6 As described above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and of course can also include other hardware required by the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to realize the above Figure 1 The method of model training or the above Figure 3 The method of capacity allocation provided. Of course, in addition to the software implementation, the specification does not exclude other implementation manners, such as logic devices or software and hardware combined manner, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic device.

[0159] It should be noted that all the actions of obtaining signals, information or data in this application are carried out in accordance with the corresponding data protection regulations and policies of the place, and with the authorization given by the owner of the corresponding device.

[0160] In the 1990s, it was quite obvious to distinguish whether an improvement in a technology was in hardware (e.g., improvement in circuit structures of diodes, transistors, switches, etc.) or in software (improvement in method flow). However, as technology has evolved, many improvements in method flow today can be considered as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structures by programming the improved method flow into hardware circuits. Therefore, it cannot be said that an improvement in a method flow cannot be implemented by hardware entity modules. For example, a programmable logic device (PLD) (e.g., a field programmable gate array (FPGA)) is an integrated circuit whose logic function is determined by user programming of the device. A digital system is "integrated" on a PLD by the designer programming it, rather than by asking a chip manufacturer to design and fabricate a custom integrated circuit chip. Moreover, instead of manually fabricating integrated circuit chips, this programming is now mostly implemented by "logic compiler" software, which is similar to software compilers used in program development, and the original code to be compiled is written in a specific programming language, which is called a hardware description language (HDL), and there are many such languages, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., and the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should be aware that, as long as the method flow is logically programmed in the above-mentioned hardware description languages and programmed into an integrated circuit, a hardware circuit implementing the logical method flow can be easily obtained.

[0161] The controller can be implemented in any suitable way, for example, the controller can take the form of a microprocessor or processor and a computer readable medium storing computer readable program code, such as software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that, in addition to being implemented in pure computer readable program code, the controller can equally well be implemented to perform the same functions using logic gates, switches, an application specific integrated circuit, a programmable logic controller and an embedded microcontroller, etc. by means of a logical programming of the method steps. The controller can thus be considered as a hardware component, and the means comprised therein for performing the various functions can be considered as structures within the hardware component. Alternatively, the means for performing the various functions can even be considered as both a software module implementing the method and a structure within the hardware component.

[0162] The systems, apparatuses, modules or units illustrated by the above embodiments can be implemented by computer chips or entities, or products with certain functions. A typical implementation device is a computer. Specifically, the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0163] For the sake of description, the above apparatuses are described in various units by functions respectively. Of course, the functions of each unit can be implemented in the same or multiple software and / or hardware in implementing the present specification.

[0164] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0165] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0166] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0167] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. ​ one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.

[0168] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0169] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer-readable media.

[0170] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0171] It should also be noted that the terms "comprising", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a list of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0172] Those skilled in the art will appreciate that embodiments of the present specification can be provided as methods, systems or computer program products. Therefore, the present specification can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0173] The present specification can be described in the general context of computer-executable instructions, such as program modules, executed by computers. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media, including storage devices.

[0174] The various embodiments described in this specification are described using a numbering of embodiments approach: these are each individually integrated contributions pertaining to different but related aspects of the description. Each of the various embodiments can stand on its own, and each can be combined with the subject matter of other embodiments to produce further embodiments. Where appropriate, therefore, the contents of the specification can be regarded as being incorporated by reference, including the description, drawings, claims, abstract and the like.

[0175] The above description is embodied in the form of embodiments only and is not intended to limit the present specification. The present specification can be variously changed and modified by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims

1. A method for training a model, characterized in that, include: Historical data is acquired. The historical data package contains regional status data corresponding to the delivery area in history and delivery capacity data of the delivery area in history. The delivery capacity data of the delivery area includes at least the number of personnel or mechanical equipment undertaking delivery work. The historical data is input into the generator to be trained to predict the delivery capacity data within the delivery area at a specified time, which is used as the predicted capacity data. Based on the predicted transport capacity data and the regional status data corresponding to the delivery area at a specified time determined by the transport capacity data, a first training sample is constructed. The first training sample is input into a preset discriminator to determine the confidence level that the first training sample belongs to real data, and the reward value corresponding to the first training sample is determined based on the confidence level of the first training sample. The generator is trained to maximize the reward value corresponding to the first training sample, wherein the generator is used to predict the capacity data required when allocating delivery capacity.

2. The method as described in claim 1, characterized in that, Based on the confidence level corresponding to the first training sample, the reward value corresponding to the first training sample is determined, specifically including: The basic reward value corresponding to the first training sample is determined based on the confidence level corresponding to the first training sample. The reward value corresponding to the first training sample is determined based on the base reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator.

3. The method as described in claim 2, characterized in that, The regional status data includes: resource incentives for delivery capacity; Determining the penalty value corresponding to the first training sample through the generator specifically includes: Modify the resource reward for delivery capacity in the historical regional status data corresponding to the delivery area in the first training sample to determine the modified first training sample. The modified first training sample is input into the generator to be trained to predict the predicted capacity data corresponding to the modified first training sample. Based on the predicted capacity data corresponding to the first training sample and the predicted capacity data corresponding to the modified first training sample, the penalty value corresponding to the first training sample is determined.

4. The method as described in claim 2, characterized in that, The reward value corresponding to the first training sample is determined based on the base reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator, specifically including: If the penalty value corresponding to the first training sample is less than the set penalty value, the reward value corresponding to the first training sample is determined based on the basic reward value corresponding to the first training sample and the penalty value corresponding to the first training sample determined by the generator. If the penalty value corresponding to the first training sample is not less than the set penalty value, the basic reward value corresponding to the first training sample is used as the reward value corresponding to the first training sample.

5. The method as described in claim 1, characterized in that, To maximize the reward value corresponding to the first training sample, the generator is trained, specifically including: The generator and the discriminator are trained with the optimization objectives of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence value corresponding to the first training sample and the label corresponding to the first training sample.

6. The method as described in claim 5, characterized in that, With the optimization objectives of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence value corresponding to the first training sample and the label corresponding to the first training sample, before training the generator and the discriminator, the method further includes: Obtain a second training sample, which includes real regional status data corresponding to the delivery area at a specified time and real delivery capacity data of the delivery area at the specified time. The first training sample and the second training sample are input into the discriminator to be trained to determine the confidence level of the first training sample belonging to real data and the confidence level of the second training sample belonging to real data. The generator and the discriminator are trained with the optimization objectives of maximizing the reward value corresponding to the first training sample and minimizing the deviation between the confidence value corresponding to the first training sample and the label corresponding to the first training sample. Specifically, this includes: The generator and the discriminator are trained with the optimization objectives of maximizing the reward value corresponding to the first training sample, minimizing the deviation between the confidence value corresponding to the first training sample and the label corresponding to the first training sample, and minimizing the deviation between the confidence value corresponding to the second training sample and the label corresponding to the second training sample.

7. A method for allocating transportation capacity, characterized in that, include: Obtain regional status data corresponding to the target delivery area; The regional status data corresponding to the target delivery area is input into the generator to predict the delivery capacity data within the target delivery area. The generator is trained by the method described in any one of claims 1 to 6. Based on the delivery capacity data within the target delivery area, delivery capacity is allocated.

8. A device for model training, characterized in that, include: The acquisition module is used to acquire historical data. The historical data package contains regional status data corresponding to the delivery area in history and delivery capacity data of the delivery area in history. The delivery capacity data of the delivery area includes at least the number of personnel or mechanical equipment undertaking delivery work. The prediction module is used to input the historical data into the generator to be trained in order to predict the delivery capacity data of the delivery area at a specified time, as the predicted capacity data. A construction module is used to construct a first training sample based on the predicted transport capacity data and the regional status data corresponding to the delivery area at a specified time determined by the transport capacity data. The input module is used to input the first training sample into a preset discriminator, determine the confidence level of the first training sample belonging to real data, and determine the reward value corresponding to the first training sample based on the confidence level of the first training sample. A training module is used to train the generator to maximize the reward value corresponding to the first training sample, wherein the generator is used to predict the capacity data required when allocating delivery capacity.

9. A device for distributing transport capacity, characterized in that, include: The acquisition module is used to acquire regional status data corresponding to the target delivery area; An input module is used to input the regional status data corresponding to the target delivery area into the generator to predict the delivery capacity data within the target delivery area. The generator is trained by the method described in any one of claims 1 to 6. The allocation module is used to allocate transportation capacity based on the capacity data of the delivery capacity within the target delivery area.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 6 or 7.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1 to 6 or 7.

Citation Information

Patent Citations

  • Price negotiation strategy model learning method based on simulation training

    CN111861648A

  • Path planning method and device, storage medium and electronic equipment

    CN113850407A