Dynamic inventory prediction and optimization method and system and application of dynamic inventory prediction and optimization method and system in take-out supermarket
By constructing a BP neural network prediction model and clustering analysis, and combining the Manta Ray optimization algorithm to optimize the purchase time point, the problem of supermarket inventory prediction and optimization is solved, and inventory costs are reduced and management efficiency is improved.
Patent Information
- Application Number
- CN202411515820.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology is difficult to effectively predict and optimize supermarket inventory, especially in the face of multiple influencing factors and different commodity attributes, resulting in an increase in inventory costs.
By collecting data on current and historical inventory influencing factors, a BP neural network prediction model is constructed to predict future inventory, and the quantity of commodity inventory is determined through clustering and European distance calculation. At the same time, the Manta ray optimization algorithm is used to optimize the purchase time point to reduce the total inventory cost.
Dynamic prediction and optimization of inventory volume is achieved, the total inventory cost is reduced, and the efficiency and accuracy of inventory management are improved.
Smart Images

Figure BDA0005106665090000092 
Figure BDA0005106665090000095 
Figure BDA0005106665090000103
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of inventory forecasting and optimization, and in particular, relates to a dynamic inventory forecasting and optimization method, system and application thereof in a takeaway supermarket. Background Art
[0002] A Chinese patent with announcement number CN113822610B discloses an inventory optimization method, apparatus, computer equipment and storage medium. First, historical data and service time range parameters of the current inventory point are obtained, and then distribution fitting is performed on these historical data to obtain the cumulative probability distribution of the current inventory point; then, based on this cumulative probability distribution, traverse within the service time range parameters to determine the holding information of the current inventory point; when it is found that the current inventory point has downstream inventory points, the holding information of the downstream inventory points is obtained, and the holding information of the current inventory point is updated based on this information; finally, based on the updated holding information of the current inventory point, safety inventory optimization information is obtained.
[0003] There are many kinds of goods in supermarkets. The inventory volume of each different kind of goods in each sales stage is different due to its different commodity attributes and adaptability to external human and environmental factors. If these external human and environmental factors are not comprehensively considered, it will be difficult to predict the inventory volume of future goods. Secondly, in the inventory process, goods will be affected by many factors. For example, as the inventory time goes by, the goods are not maintained in time, accidentally damaged by human factors, and occupy space, which leads to an increase in their inventory costs. The inventory time depends on the purchase time and the shipment time. If the purchase time of each type of goods cannot be reasonably set, the inventory cost may increase significantly, thereby causing unnecessary losses to the supermarket. Summary of the invention
[0004] In view of the problems in the related technology, the present invention proposes a dynamic inventory forecasting and optimization method, system and its application in a takeaway supermarket to overcome the above-mentioned technical problems existing in the existing related technology.
[0005] To solve the above technical problems, the present invention is achieved through the following technical solutions:
[0006] The present invention is a dynamic inventory forecasting and optimization method, comprising the following steps:
[0007] S1. Collect the influencing factor data corresponding to the current and historical various inventory influencing factor types and the corresponding cleared inventory of various types of goods to obtain the current influencing factor data matrix, the historical influencing factor data set matrix and the historical commodity inventory quantity matrix;
[0008] S2. Use the current influencing factor data matrix to construct a final BP neural network prediction model and predict the inventory influencing factor data at a future time point to obtain a future influencing factor data matrix; perform a clustering operation on the historical influencing factor data set matrix and calculate the average inventory quantity of each type of commodity in each historical statistical time period to obtain a historical influencing factor data set classification center matrix and a historical commodity inventory average inventory quantity matrix;
[0009] S3. Equally divide the current influencing factor data matrix and the future influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set; classify and obtain the commodity inventory quantity corresponding to the comprehensive stage influencing factor data matrix set according to the classification center matrix of the historical influencing factor data set to obtain a comprehensive stage commodity inventory quantity matrix;
[0010] S4, optimizing the pre-selected purchase time points from the multiple statistical prediction time points corresponding to the comprehensive stage influencing factor data matrix set by calculating the total inventory cost in conjunction with the comprehensive stage commodity inventory quantity matrix to obtain a final purchase time point set;
[0011] The inventory of goods in a supermarket is generally affected by multiple factors, and different types of goods are affected to different degrees by the same influencing factors, resulting in different inventory quantities. Based on the above, this solution first collects the influencing factor data corresponding to the current and historical types of inventory influencing factors and the corresponding cleared inventory of various types of goods, to provide data support for the subsequent construction of a prediction model for predicting the inventory influencing factor data at future moments. By constructing the final BP neural network prediction model, the inventory influencing factor data at future moments is predicted, providing data support for the subsequent acquisition of the corresponding inventory of various types of goods that should be reserved. By clustering the historical influencing factor data set matrix and calculating the average inventory quantity of each type of goods in each historical statistical time period, it is used to establish inventory influencing factors of various data quantities. The corresponding relationship between the influencing factor data and the corresponding inventory of each type of goods is obtained, so that when the classification of the comprehensive influencing factor data at the current and future moments is obtained later, the corresponding quantity of each type of goods that should be in stock can be obtained according to the classification results; since the above classification of various influencing factors is only for a smaller time period, therefore, by equally dividing the current influencing factor data matrix and the future influencing factor data matrix, it is convenient to classify the various types of influencing factor data of each divided stage, and then obtain the corresponding inventory quantity of each type of goods; because when the inventory of goods is about to be sold out, it is necessary to purchase goods in order to provide goods for the next stage of sale, and different purchase times have an impact on the total inventory cost of the entire stage; therefore, in this solution, multiple purchase time points are optimized to minimize the total inventory cost of the entire stage.
[0012] Preferably, the S1 comprises the following steps:
[0013] S11. Set multiple commodity types to obtain a commodity type set; set multiple types of factors affecting commodity inventory to obtain a type set of factors affecting inventory;
[0014] S12, setting an inventory forecast statistical cycle; evenly setting multiple time points within the inventory forecast statistical cycle to obtain a statistical forecast time point set; collecting inventory influencing factor data at several current time points according to the statistical forecast time point set and the inventory influencing factor type set to obtain a current influencing factor data matrix;
[0015] S13, setting multiple historical statistical time periods to obtain a historical statistical time period set; setting a number of time points in each historical statistical time period in the historical statistical time period set to obtain a historical statistical time point matrix; collecting inventory influencing factor data at corresponding time points and corresponding cleared inventory of various types of goods according to the historical statistical time point matrix to obtain a historical influencing factor data set matrix and a historical commodity inventory quantity matrix;
[0016] The types of goods mainly include fresh food, convenience food, beverages, snacks, cleaning products, personal care products, household products, men's clothing, women's clothing, children's clothing, mobile phones, computers, home appliances, office supplies, seasonal goods and holiday gifts; the types of factors affecting inventory mainly include seasonal demand, market demand fluctuations, natural disasters, changes in policies and regulations, social events, procurement strategies, inventory monitoring efforts, supply chain management level, and employee management and operation level.
[0017] Preferably, S2 comprises the following steps:
[0018] S21, constructing an initial BP neural network prediction model;
[0019] S22, using the current influencing factor data matrix to train and test the initial BP neural network prediction model and predict the inventory influencing factor data at future time points in the statistical prediction time point set to obtain a future influencing factor data matrix;
[0020] S23, performing a clustering operation on the historical influencing factor data set matrix to obtain a historical influencing factor data set classification center matrix and a historical influencing factor data set classification matrix set;
[0021] S24, calculating the average value of the inventory quantity of each type of commodity in each historical statistical time period according to the classification matrix set of the historical influencing factor data set;
[0022] The BP neural network prediction model, also known as the back propagation neural network, is a machine learning model widely used in various fields; it has powerful nonlinear mapping capabilities, flexibility and adaptability, strong generalization ability, self-learning and self-adaptation, parallel computing, strong adaptability, and high interpretability; based on this, this solution uses the BP neural network model to predict the inventory influencing factor data at future moments, making the prediction more accurate; by clustering the historical influencing factor data set matrix, the historical influencing factor data set classification center matrix is obtained, which provides a classification tool for the subsequent classification of the current influencing factor data and the influencing factor data at future moments.
[0023] Preferably, the S24 comprises the following steps:
[0024] S241, classifying the historical commodity inventory quantity matrix c2 according to the historical influencing factor data set classification matrix set to obtain a historical commodity inventory quantity classification matrix set;
[0025] S242, calculating the average inventory quantity of each type of goods in each historical statistical time period in each historical commodity inventory quantity classification matrix in the historical commodity inventory quantity classification matrix set to obtain a historical commodity inventory average inventory quantity matrix;
[0026] Preferably, S3 comprises the following steps:
[0027] S31, merging the future influencing factor data matrix and the current influencing factor data matrix to obtain a comprehensive influencing factor data matrix;
[0028] S32, equally dividing the comprehensive influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set;
[0029] S33, calculating the Euclidean distance between each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set and each historical influencing factor data set classification center in the historical influencing factor data set classification center matrix, to obtain a first Euclidean distance matrix;
[0030] The historical commodity inventory average quantity set in the historical commodity inventory average quantity matrix corresponding to the minimum Euclidean distance data in each row of the first Euclidean distance matrix is used as the commodity inventory quantity set of the influencing factor data matrix of the comprehensive stage, to obtain the commodity inventory quantity matrix of the comprehensive stage;
[0031] By calculating the Euclidean distance between each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set and each historical influencing factor data set classification center in the historical influencing factor data set classification center matrix, the smaller the Euclidean distance, the more similar the two data are. The two data with the smallest Euclidean distance are classified into one category, thereby classifying each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set.
[0032] Preferably, S4 comprises the following steps:
[0033] S41, randomly selecting a statistical prediction time point from a plurality of statistical prediction time points in the statistical prediction time point set corresponding to each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set to purchase goods, to obtain an initial purchase time point set;
[0034] S42, performing a purchase operation according to the initial purchase time point set, and after the inventory forecast statistical cycle ends, calculating the total inventory cost in conjunction with the stage commodity inventory quantity matrix to obtain initial inventory cost data;
[0035] S43, setting an inventory cost threshold; when the initial inventory cost data is greater than or equal to the inventory cost threshold, optimizing the initial purchase time point set until the initial inventory cost data is less than the inventory cost threshold, thereby obtaining a final purchase time point set;
[0036] Since the commodity inventory in each stage needs to be replenished after being consumed, based on this, in this scheme, a statistical prediction time point is randomly selected from a plurality of statistical prediction time points in the statistical prediction time point set corresponding to each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set to purchase goods, so as to pre-set a group of pending purchase time points, and then evaluate the total inventory cost of the entire stage of purchase according to such purchase time points; when the total inventory cost of the entire stage does not meet the requirements, this group of purchase time points is optimized and adjusted to minimize the total inventory cost of the entire stage, thereby saving the inventory cost of the supermarket.
[0037] Preferably, optimizing the initial purchase time point set in S43 includes the following steps:
[0038] S431, construct a second manta ray population; set the maximum number of iterations of the second manta ray population to e3′ and the current number of iterations to e′4, which are recorded as the second maximum number of iterations and the second current number of iterations respectively; the search space dimension of the second manta ray population is
[0039] S432, randomly selecting a statistical prediction time point from a plurality of statistical prediction time points in the statistical prediction time point set corresponding to each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set as the initial position of each manta ray in the second manta ray population, to obtain a second initial position matrix;
[0040] S433, constructing a fitness function of a second manta ray population according to the initial inventory cost data;
[0041] S434, start iteration, and set the second current iteration number to 1 before iteration; in the first round of iteration, use the fitness function of the second manta ray population to calculate the fitness value of the initial position of each manta ray in the second initial position matrix to obtain a third fitness value; use the maximum fitness value of the third fitness values and the corresponding initial position of the manta ray in the second manta ray population as the third global optimal fitness and the third global optimal position respectively; update the initial position of each manta ray in the second initial position matrix according to the third global optimal fitness and the third global optimal position; after the update is completed, add 1 to the second current iteration number and enter the next round of iteration;
[0042] In each other round of iteration, the fitness function of the second manta ray population is used to calculate the fitness value of the position of each manta ray in the second manta ray population updated in the previous round of iteration, to obtain a fourth fitness value; the maximum fitness value among the fourth fitness values and the corresponding position of the manta ray in the second manta ray population are respectively used as the fourth global optimal fitness and the fourth global optimal position; the position matrix of each manta ray in the second manta ray population updated in the previous round of iteration is updated again according to the fourth global optimal fitness and the fourth global optimal position; after the update is completed, the second current iteration number is increased by 1 and the next round of iteration is entered;
[0043] S435. When e′4≥e3′, stop the iteration and obtain the second final global optimal position; otherwise, continue the iteration until e′2≥e1′; use the second final global optimal position as the optimized purchase time point set; perform the purchase operation according to the optimized purchase time point set, and when the inventory forecast statistical cycle ends, calculate the total inventory cost to obtain the optimized inventory cost data;
[0044] When the optimized inventory cost data is less than the inventory cost threshold, the optimized purchase time point set is used as the final purchase time point set; otherwise, return to S434 and continue to iterate until the optimized inventory cost data is less than the inventory cost threshold;
[0045] The manta ray optimization algorithm is used to perform multiple iterative optimizations on the purchase time point. The total inventory cost of the entire stage is calculated in each round of iteration, so that the purchase time point is updated and adjusted in the direction of reducing the total inventory cost. When the iteration is completed, the total inventory cost corresponding to the updated purchase time point reaches the minimum, thus meeting the requirements.
[0046] The dynamic inventory forecasting and optimization method system includes a current inventory influencing factor data collection module, a historical inventory influencing factor data collection module, a historical commodity inventory quantity collection module, a forecasting model building module, a forecasting module, a clustering module, a historical commodity inventory quantity mean calculation module, an influencing factor data averaging module, a commodity inventory quantity classification acquisition module and a purchase time point optimization module.
[0047] The present invention has the following beneficial effects:
[0048] 1. In the present invention, multiple purchase time points are optimized to minimize the total inventory cost of the entire stage; wherein, by clustering the historical influencing factor data set matrix and calculating the average inventory quantity of each type of commodity in each historical statistical time period, a corresponding relationship between the inventory influencing factor data of various data amounts and the corresponding inventory quantities of various types of commodities is established, so that when the classification of the comprehensive influencing factor data at the current and future moments is subsequently obtained, the corresponding quantity of each type of commodity that should be in stock can be obtained according to the classification result; by equally dividing the current influencing factor data matrix and the future influencing factor data matrix, it is convenient to classify the various types of influencing factor data of each divided stage in the subsequent process, and then obtain the corresponding inventory quantity of each type of commodity.
[0049] 2. In the present invention, the Euclidean distance is calculated. The smaller the Euclidean distance is, the more similar the two data are. The two data with the smallest Euclidean distance are classified into one category, thereby classifying each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set.
[0050] 3. In the present invention, the manta ray optimization algorithm is used to perform multiple iterative optimizations on the purchase time point. The total inventory cost of the corresponding entire stage is calculated in each round of iteration, so that the purchase time point is updated and adjusted in the direction of reducing the total inventory cost; when the iteration is completed, the total inventory cost corresponding to the updated purchase time point reaches the minimum, thereby meeting the requirements.
[0051] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, they can also obtain drawings based on these drawings without paying creative work.
[0053] Figure 1 It is a schematic diagram of the flow of the dynamic inventory forecasting and optimization method of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the invention to clearly and completely describe the technical solutions in the embodiments of the invention. Obviously, the described embodiments are only part of the embodiments of the invention, not all of the embodiments. Based on the embodiments in the invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the invention.
[0055] In the description of the present invention, it is necessary to understand that the terms "opening", "upper", "lower", "top", "middle", "inside" and the like indicating orientation or positional relationship are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the invention.
[0056] Embodiment 1
[0057] This embodiment is a dynamic inventory forecasting and optimization method, which includes the following steps:
[0058] S1. Collect the influencing factor data corresponding to the current and historical various inventory influencing factor types and the corresponding cleared inventory of various types of goods to obtain the current influencing factor data matrix, the historical influencing factor data set matrix and the historical commodity inventory quantity matrix;
[0059] The S1 comprises the following steps:
[0060] S11. Set multiple commodity types to obtain a commodity type set a = {a1, a2, ..., a i ,...,a a′}, a i represents the i-th type of commodity, a′ represents the total quantity of the commodity type; multiple influencing factor types that affect the inventory of commodities are set to obtain the inventory influencing factor type set represents the influencing factors of the i-th type of inventory quantity, Indicates the total quantity of the set inventory influencing factor type;
[0061] S12, setting an inventory forecast statistical cycle; evenly setting multiple time points within the inventory forecast statistical cycle to obtain a statistical forecast time point set b = {b1, b2, ..., b i ,...,b b′}, b irepresents the i-th time point set in the inventory forecast statistical period, and b′ represents the total number of time points set in the inventory forecast statistical period; according to the statistical forecast time point set and the inventory influencing factor type set, the inventory influencing factor data of several current time points are collected to obtain the current influencing factor data matrix as follows,
[0062]
[0063] in, represents the j-th type of inventory influencing factor data at the i-th time point in the statistical forecast time point set, Indicates the total number of time points corresponding to the current statistical influencing factor data;
[0064] S13, set multiple historical statistical time periods to obtain a historical statistical time period set; set a number of time points in each historical statistical time period in the historical statistical time period set to obtain a historical statistical time point matrix; collect inventory influencing factor data at corresponding time points and corresponding cleared inventory of various types of goods according to the historical statistical time point matrix to obtain a historical influencing factor data set matrix c1 and a historical commodity inventory quantity matrix c2; respectively as follows,
[0065]
[0066] Among them, c 1ij represents the inventory influencing factor data set at the jth historical statistical time point in the i-th historical statistical time period in the historical statistical time period set, and b1′ represents the total number of historical statistical time points set in each historical statistical time period in the historical statistical time period set; c 1ijk Indicates c 1ij The kth type of inventory influencing factor data, c′ represents the total quantity of the historical statistical time period in the historical statistical time period; c 2ij represents the total inventory of the jth type of goods in the i-th historical statistical time period in the historical statistical time period set;
[0067] S2. Use the current influencing factor data matrix to construct a final BP neural network prediction model and predict the inventory influencing factor data at a future time point to obtain a future influencing factor data matrix; perform a clustering operation on the historical influencing factor data set matrix and calculate the average inventory quantity of each type of commodity in each historical statistical time period to obtain a historical influencing factor data set classification center matrix and a historical commodity inventory average inventory quantity matrix;
[0068] The S2 comprises the following steps:
[0069] S21, constructing an initial BP neural network prediction model;
[0070] S22, using the current influencing factor data matrix The initial BP neural network prediction model is trained and tested, and the statistical prediction time point set b = {b1, b2, ..., b i ,...,b b′} to predict the inventory influencing factors at future time points and obtain the future influencing factors data matrix as follows,
[0071]
[0072] in, Represents the j-th type of inventory influencing factor data at the i-th future time point, Indicates the total quantity at a future time point corresponding to the predicted inventory influencing factor data;
[0073] The S22 comprises the following steps:
[0074] S221, setting the training data ratio and the test data ratio; and calculating the current influencing factor data matrix according to the training data ratio and the test data ratio. Perform data division to obtain a current influencing factor training data matrix, a current influencing factor test data matrix, and a current influencing factor to-be-predicted data matrix;
[0075] S222, setting a training error threshold; inputting the current influencing factor training data matrix into the initial BP neural network prediction model for training operation; during the training process, when the training error is less than the training error threshold, stopping the training to obtain a trained BP neural network prediction model; otherwise, continuing the training until the training error is less than the training error threshold;
[0076] S223, set a test accuracy threshold; input the current influencing factor test data matrix into the trained BP neural network prediction model for testing; after the test is completed, obtain the test accuracy; when the test accuracy is greater than or equal to the test accuracy threshold, use the trained BP neural network prediction model as the final BP neural network prediction model; otherwise, return to S222 to continue training the trained BP neural network prediction model until the test accuracy is greater than or equal to the test accuracy threshold, and obtain the final BP neural network prediction model;
[0077] S224, input the current influencing factor to-be-predicted data matrix into the final BP neural network prediction model for prediction operation, and obtain the future influencing factor data matrix
[0078] By using the current influencing factor training data matrix and the current influencing factor test data matrix to train and test the initial BP neural network prediction model, the final BP neural network prediction model has a good prediction ability for the inventory influencing factor data;
[0079] S23, performing a clustering operation on the historical influencing factor data set matrix c1 to obtain a classification center matrix of the historical influencing factor data set And the classification matrix set of historical influencing factor dataset represents the i-th historical influencing factor data set classification matrix obtained by performing a clustering operation on the historical influencing factor data set matrix c1, represents the total number of classifications obtained by performing a clustering operation on the historical influencing factor data set matrix c1; They are as follows:
[0080]
[0081] in, The inventory influencing factor dataset at the jth historical statistical time point in the classification center dataset of the ith classification obtained by performing a clustering operation on the historical influencing factor dataset matrix c1;
[0082] express The k-th type of inventory influencing factor data; express The data set of factors affecting inventory at the kth historical statistical time point in the jth historical statistical time period; express The data of the factors affecting the inventory volume of the kth type, d i express The total number of historical statistical time periods divided;
[0083] The S23 comprises the following steps:
[0084] S231. Establishing the first manta ray population represents the kth manta ray in the first manta ray population, e1 represents the size of the first manta ray population; the maximum number of iterations of the first manta ray population is set to e1′ and the current number of iterations is set to e′2, which are recorded as the first maximum number of iterations and the first current number of iterations respectively; the search space dimension of the first manta ray population is
[0085] S232, randomly selecting a number of rows of data from the historical influencing factor data set matrix c1 as the initial position matrix of each manta ray in the first manta ray population, and obtaining a first initial position matrix set represents the initial position matrix of the kth manta ray in the first manta ray population, as follows,
[0086]
[0087] in, The component set representing the initial position matrix of the k-th manta ray in the first manta ray population on the dimension of the inventory influencing factor dataset at the j-th historical statistical time point in the i-th classification center dataset;
[0088] express The component of the k′th type of inventory influencing factor data dimension;
[0089] S233, calculating the Euclidean distance between each row of data in the historical influencing factor data set matrix c1 and each row of data in the initial position matrix of the k-th manta ray in the first manta ray population, and obtaining the Euclidean distance matrix of the k-th manta ray in the first manta ray population as follows,
[0090]
[0091] in, represents the Euclidean distance between the i-th row of data in the matrix c1 of the historical influencing factor data set and the j-th row of data in the initial position matrix of the k-th manta ray in the first manta ray population;
[0092] According to the Euclidean distance matrix of the kth manta ray in the first manta ray population Construct the fitness function f of the kth manta ray in the first manta ray population k ;as follows,
[0093]
[0094] S234, start iteration, and before iteration, set the first current iteration number e′2 to 1; in the first round of iteration, use the fitness function f of the kth manta ray in the first manta ray populationk Calculate the first initial position matrix set The fitness value of the initial position matrix of each manta ray in the first manta ray population is obtained to obtain a first fitness value; the maximum fitness value among the first fitness values and the corresponding initial position matrix of manta rays in the first manta ray population are respectively used as the first global optimal fitness and the first global optimal position; the first initial position matrix set is adjusted according to the first global optimal fitness and the first global optimal position. The initial position matrix of each manta ray in is updated; after the update is completed, the first current iteration number e′2 is increased by 1 and the next round of iteration is entered;
[0095] In each other iteration, the fitness function f of the kth manta ray in the first manta ray population is used. k Calculate the fitness value of the position matrix of each manta ray in the first manta ray population updated in the previous round of iterations to obtain a second fitness value; use the maximum fitness value of the second fitness values and the corresponding position matrix of manta rays in the first manta ray population as the second global optimal fitness and the second global optimal position respectively; update the position matrix of each manta ray in the first manta ray population updated in the previous round of iterations according to the second global optimal fitness and the second global optimal position; after the update is completed, add 1 to the first current iteration number e′2 and enter the next round of iterations;
[0096] S235. When e′2≥e1′, stop the iteration and obtain the first final global optimal position; otherwise, continue the iteration until e′2≥e1′; use the first final global optimal position as the classification center matrix of the historical influencing factor data set According to the historical influencing factor data set classification center matrix Classify the historical influencing factor data set matrix c1 to obtain the historical influencing factor data set classification matrix set
[0097] The manta ray optimization algorithm can effectively explore the entire search space and avoid falling into the local optimal solution by simulating the foraging behavior of manta rays. By continuously optimizing the search strategy, the optimal solution can be quickly found. Only a few parameters need to be set, which is easy to implement and insensitive to initial conditions and parameter settings. It has strong robustness. Based on the above advantages of the manta ray optimization algorithm, the manta ray optimization algorithm is used in this scheme to perform multiple iterations on the central data of multiple categories in the historical influencing factor data set matrix, and the overall discreteness of the historical influencing factor data set matrix is used as the fitness function. Therefore, as the iteration proceeds, the overall discreteness of the historical influencing factor data set matrix becomes smaller and smaller, indicating that the classification effect of the iteratively obtained classification center data is better.
[0098] S24, classifying the matrix set according to the historical influencing factor data set Calculate the average inventory quantity of each type of goods in each historical statistical time period;
[0099] The S24 comprises the following steps:
[0100] S241, classifying the matrix set according to the historical influencing factor data set Classify the historical commodity inventory quantity matrix c2 to obtain the historical commodity inventory quantity classification matrix set d i ′ represents the i-th historical commodity inventory quantity classification matrix obtained by classifying the historical commodity inventory quantity matrix c2; as follows,
[0101]
[0102] Among them, d i ' jk Indicates d i The inventory quantity of the kth type of goods in the jth historical statistical time period in ′;
[0103] S242: Calculate the average inventory quantity of each type of commodity in each historical statistical time period in each historical commodity inventory quantity classification matrix in the historical commodity inventory quantity classification matrix set to obtain a historical commodity inventory average inventory quantity matrix. as follows,
[0104]
[0105] in, represents the average inventory quantity of the jth type of commodity in each historical statistical time period in the i-th historical commodity inventory quantity classification matrix in the historical commodity inventory quantity classification matrix set;
[0106] S3. Equally divide the current influencing factor data matrix and the future influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set; classify and obtain the commodity inventory quantity corresponding to the comprehensive stage influencing factor data matrix set according to the classification center matrix of the historical influencing factor data set to obtain a comprehensive stage commodity inventory quantity matrix;
[0107] The S3 comprises the following steps:
[0108] S31, the future influencing factor data matrix And the current influencing factor data matrix Merge to obtain the comprehensive influencing factor data matrix as follows,
[0109]
[0110] in, Represents the j-th type of inventory influencing factor data at the i-th statistical forecast time point in the statistical forecast time point set;
[0111] S32, the comprehensive influencing factor data matrix Divide evenly to obtain the data matrix set of influencing factors in the comprehensive stage f i ′ represents the comprehensive influencing factor data matrix The data matrix of influencing factors of the i-th comprehensive stage obtained by averaging is: Represents the data matrix of the comprehensive influencing factors The total number of data matrices of influencing factors in the comprehensive stage obtained by averaging; f i 'as follows,
[0112]
[0113] Among them, f ij ' k represents f i The k-th type of inventory influencing factor data at the j-th statistical forecast time point in ′;
[0114] S33, calculating the data matrix set of influencing factors in the comprehensive stage The influencing factor data matrix of each comprehensive stage in the classification center matrix of the historical influencing factor data set The Euclidean distance between the classification centers of each historical influencing factor dataset is obtained to obtain the first Euclidean distance matrix as follows,
[0115]
[0116] in, Represents the classification center matrix of the i-th comprehensive stage influencing factor data matrix set to the historical influencing factor data set The Euclidean distance between the classification centers of the j-th historical influencing factor dataset;
[0117] The first Euclidean distance matrix The historical commodity inventory average inventory quantity matrix corresponding to the smallest Euclidean distance data in each row The historical average inventory quantity set of commodity inventory in is used as the commodity inventory quantity set of the influencing factor data matrix of the comprehensive stage, and the comprehensive stage commodity inventory quantity matrix g is obtained; as follows,
[0118]
[0119] Among them, gij represents the inventory quantity of the jth type of goods corresponding to the i-th comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set;
[0120] S4, optimizing the pre-selected purchase time points from the multiple statistical prediction time points corresponding to the comprehensive stage influencing factor data matrix set by calculating the total inventory cost in conjunction with the comprehensive stage commodity inventory quantity matrix to obtain a final purchase time point set;
[0121] The S4 comprises the following steps:
[0122] S41, from the comprehensive stage influencing factor data matrix set A statistical prediction time point is randomly selected from the multiple statistical prediction time points corresponding to the statistical prediction time point set of the influencing factor data matrix of each comprehensive stage to purchase goods, and the initial purchase time point set is obtained. g i ′ represents the i-th purchase time point initially selected;
[0123] S42, according to the initial purchase time point set To carry out the purchase operation, when the inventory forecast statistical cycle is over, the total inventory cost is calculated in conjunction with the stage commodity inventory quantity matrix to obtain the initial inventory cost data
[0124] S43, setting an inventory cost threshold; when the initial inventory cost data is greater than or equal to the inventory cost threshold, optimizing the initial purchase time point set until the initial inventory cost data is less than the inventory cost threshold, thereby obtaining a final purchase time point set;
[0125] Optimizing the initial purchase time point set in S43 includes the following steps:
[0126] S431. Establishing the second manta ray population represents the kth manta ray in the first manta ray population, and e2 represents the size of the second manta ray population; the maximum number of iterations of the second manta ray population is set to e3′ and the current number of iterations is set to e′4, which are recorded as the second maximum number of iterations and the second current number of iterations respectively; the search space dimension of the second manta ray population is
[0127] S432, multiple times from the comprehensive stage influencing factor data matrix set A statistical prediction time point is randomly selected from the multiple statistical prediction time points in the statistical prediction time point set corresponding to the influencing factor data matrix of each comprehensive stage as the initial position of each manta ray in the second manta ray population, and the second initial position matrix is obtained. as follows,
[0128]
[0129] in, represents the component of the initial position of the i-th manta ray in the second manta ray population in the j-th search space dimension;
[0130] S433: Based on the initial inventory cost data Constructing the fitness function of the second manta ray population as follows,
[0131]
[0132] S434, start iteration, and before iteration, set the second current iteration number e′4 to 1; in the first round of iteration, use the fitness function of the second manta ray population Calculate the second initial position matrix The fitness value of the initial position of each manta ray in the second manta ray population is obtained to obtain a third fitness value; the maximum fitness value among the third fitness values and the corresponding initial position of the manta ray in the second manta ray population are respectively used as the third global optimal fitness and the third global optimal position; the second initial position matrix is adjusted according to the third global optimal fitness and the third global optimal position. After the update is completed, the second current iteration number e′4 is increased by 1 and the next iteration is entered;
[0133] In each other iteration, the fitness function of the second manta ray population is used Calculate the fitness value of the position of each manta ray in the second manta ray population updated in the previous round of iteration to obtain a fourth fitness value; use the maximum fitness value among the fourth fitness values and the corresponding position of the manta ray in the second manta ray population as the fourth global optimal fitness and the fourth global optimal position respectively; update the position matrix of each manta ray in the second manta ray population updated in the previous round of iteration according to the fourth global optimal fitness and the fourth global optimal position; after the update is completed, add 1 to the second current iteration number e′4 and enter the next round of iteration;
[0134] S435. When e′4≥e3′, stop the iteration and obtain the second final global optimal position; otherwise, continue the iteration until e′2≥e1′; use the second final global optimal position as the optimized purchase time point set; perform the purchase operation according to the optimized purchase time point set, and when the inventory forecast statistical cycle ends, calculate the total inventory cost to obtain the optimized inventory cost data;
[0135] When the optimized inventory cost data is less than the inventory cost threshold, the optimized purchase time point set is used as the final purchase time point set; otherwise, return to S434 and continue to iterate until the optimized inventory cost data is less than the inventory cost threshold.
[0136] Embodiment 2
[0137] This embodiment discloses a dynamic inventory forecasting and optimization method system, which can implement the method of the above embodiment, including a current inventory influencing factor data collection module, a historical inventory influencing factor data collection module, a historical commodity inventory quantity collection module, a forecasting model construction module, a forecasting module, a clustering module, a historical commodity inventory quantity mean value calculation module, an influencing factor data averaging module, a commodity inventory quantity classification acquisition module and a purchase time point optimization module;
[0138] The current inventory influencing factor data collection module is used to collect influencing factor data corresponding to multiple inventory influencing factor types in real time to obtain a current influencing factor data matrix;
[0139] The historical inventory influencing factor data collection module is used to collect inventory influencing factor data at multiple historical time points to obtain a historical influencing factor data set matrix;
[0140] The historical commodity inventory quantity collection module is used to collect the cleared inventory quantities of various types of commodities corresponding to the historical influencing factor data set matrix at historical time points to obtain a historical commodity inventory quantity matrix;
[0141] The prediction model building module is used to construct a final BP neural network prediction model using the current influencing factor data matrix;
[0142] The prediction module is used to use the final BP neural network prediction model to predict the inventory influencing factor data at a future time point to obtain a future influencing factor data matrix;
[0143] The clustering module is used to perform a clustering operation on the historical influencing factor data set matrix to obtain a historical influencing factor data set classification center matrix and a historical influencing factor data set classification matrix set;
[0144] The historical commodity inventory quantity mean value calculation module is used to calculate the average value of the inventory quantity of each type of commodity in each historical statistical time period according to the historical influencing factor data set classification matrix set to obtain a historical commodity inventory average inventory quantity matrix;
[0145] The influencing factor data averaging module is used to average the current influencing factor data matrix and the future influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set;
[0146] The commodity inventory quantity classification acquisition module is used to classify and acquire the commodity inventory quantity corresponding to the comprehensive stage influencing factor data matrix set according to the historical influencing factor data set classification center matrix, and obtain the comprehensive stage commodity inventory quantity matrix;
[0147] The purchase time point optimization module is used to cooperate with the comprehensive stage commodity inventory quantity matrix to calculate the total inventory cost and optimize the pre-selected purchase time points from multiple statistical prediction time points corresponding to the comprehensive stage influencing factor data matrix set to obtain a final purchase time point set.
[0148] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0149] The preferred embodiments of the invention disclosed above are only used to help explain the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the invention, so that those skilled in the art can understand and use the invention well.
Claims
1. Dynamic inventory forecasting and optimization method, characterized in that: The following steps are involved: S1. Collect the influencing factor data corresponding to the current and historical various inventory influencing factor types and the corresponding cleared inventory of various types of goods to obtain the current influencing factor data matrix, the historical influencing factor data set matrix and the historical commodity inventory quantity matrix; S2, using the current influencing factor data matrix to construct a final BP neural network prediction model and predict the inventory influencing factor data at a future time point to obtain a future influencing factor data matrix; Performing a clustering operation on the historical influencing factor data set matrix and calculating the average inventory quantity of each type of commodity in each historical statistical time period to obtain a historical influencing factor data set classification center matrix and a historical commodity inventory average inventory quantity matrix; S3. Equally divide the current influencing factor data matrix and the future influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set; classify and obtain the commodity inventory quantity corresponding to the comprehensive stage influencing factor data matrix set according to the classification center matrix of the historical influencing factor data set to obtain a comprehensive stage commodity inventory quantity matrix; S4. Calculating the total inventory cost in conjunction with the commodity inventory quantity matrix of the comprehensive stage is performed to optimize the pre-selected purchase time points from the multiple statistical prediction time points corresponding to the comprehensive stage influencing factor data matrix set to obtain a final purchase time point set.
2. The dynamic inventory forecasting and optimization method according to claim 1, characterized in that: The S1 comprises the following steps: S11. Set multiple commodity types to obtain a commodity type set; set multiple types of factors affecting commodity inventory to obtain a type set of factors affecting inventory; S12, setting an inventory forecast statistical cycle; evenly setting multiple time points within the inventory forecast statistical cycle to obtain a statistical forecast time point set; collecting inventory influencing factor data at several current time points according to the statistical forecast time point set and the inventory influencing factor type set to obtain a current influencing factor data matrix; S13. Set multiple historical statistical time periods to obtain a historical statistical time period set; set a number of time points in each historical statistical time period in the historical statistical time period set to obtain a historical statistical time point matrix; collect inventory influencing factor data at corresponding time points and corresponding cleared inventory of various types of goods according to the historical statistical time point matrix to obtain a historical influencing factor data set matrix and a historical commodity inventory quantity matrix.
3. The dynamic inventory forecasting and optimization method according to claim 2, characterized in that: The S2 comprises the following steps: S21, constructing an initial BP neural network prediction model; S22, using the current influencing factor data matrix to train and test the initial BP neural network prediction model and predict the inventory influencing factor data at future time points in the statistical prediction time point set to obtain a future influencing factor data matrix; S23, performing a clustering operation on the historical influencing factor data set matrix to obtain a historical influencing factor data set classification center matrix and a historical influencing factor data set classification matrix set; S24. Calculate the average value of the inventory quantity of each type of commodity in each historical statistical time period according to the classification matrix set of the historical influencing factor data set.
4. The dynamic inventory forecasting and optimization method according to claim 3, characterized in that: In S23, a clustering operation is performed on the historical influencing factor data set matrix using a manta ray optimization algorithm.
5. The dynamic inventory forecasting and optimization method according to claim 4, characterized in that: The S24 comprises the following steps: S241, classifying the historical commodity inventory quantity matrix according to the historical influencing factor data set classification matrix set to obtain a historical commodity inventory quantity classification matrix set; S242. Calculate the average inventory quantity of each type of commodity in each historical statistical time period in each historical commodity inventory quantity classification matrix in the historical commodity inventory quantity classification matrix set to obtain a historical commodity inventory average inventory quantity matrix.
6. The dynamic inventory forecasting and optimization method according to claim 5, characterized in that: The S3 comprises the following steps: S31, merging the future influencing factor data matrix and the current influencing factor data matrix to obtain a comprehensive influencing factor data matrix; S32, equally dividing the comprehensive influencing factor data matrix to obtain a comprehensive stage influencing factor data matrix set; S33. Calculate the Euclidean distance between each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set and each historical influencing factor data set classification center in the historical influencing factor data set classification center matrix to obtain a first Euclidean distance matrix; use the historical commodity inventory average inventory quantity set in the historical commodity inventory average inventory quantity matrix corresponding to the minimum Euclidean distance data in each row of the first Euclidean distance matrix as the commodity inventory quantity set of the comprehensive stage influencing factor data matrix to obtain the comprehensive stage commodity inventory quantity matrix.
7. The dynamic inventory forecasting and optimization method according to claim 6, characterized in that: The S4 comprises the following steps: S41, randomly selecting a statistical prediction time point from a plurality of statistical prediction time points in the statistical prediction time point set corresponding to each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set to purchase goods, to obtain an initial purchase time point set; S42, performing a purchase operation according to the initial purchase time point set, and after the inventory forecast statistical cycle ends, calculating the total inventory cost in conjunction with the stage commodity inventory quantity matrix to obtain initial inventory cost data; S43, setting an inventory cost threshold; when the initial inventory cost data is greater than or equal to the inventory cost threshold, optimizing the initial purchase time point set until the initial inventory cost data is less than the inventory cost threshold, to obtain a final purchase time point set.
8. The dynamic inventory forecasting and optimization method according to claim 7, characterized in that: Optimizing the initial purchase time point set in S43 includes the following steps: S431, constructing a second manta ray population; setting the maximum number of iterations of the second manta ray population to e3′ and the current number of iterations to e′4, which are recorded as the second maximum number of iterations and the second current number of iterations respectively; S432, randomly selecting a statistical prediction time point from a plurality of statistical prediction time points in the statistical prediction time point set corresponding to each comprehensive stage influencing factor data matrix in the comprehensive stage influencing factor data matrix set as the initial position of each manta ray in the second manta ray population, to obtain a second initial position matrix; S433, constructing a fitness function of a second manta ray population according to the initial inventory cost data; S434, start iteration, and set the second current iteration number to 1 before iteration; in the first round of iteration, use the fitness function of the second manta ray population to calculate the fitness value of the initial position of each manta ray in the second initial position matrix to obtain a third fitness value; use the maximum fitness value of the third fitness values and the corresponding initial position of the manta ray in the second manta ray population as the third global optimal fitness and the third global optimal position respectively; update the initial position of each manta ray in the second initial position matrix according to the third global optimal fitness and the third global optimal position; after the update is completed, add 1 to the second current iteration number and enter the next round of iteration; In each other round of iteration, the fitness function of the second manta ray population is used to calculate the fitness value of the position of each manta ray in the second manta ray population updated in the previous round of iteration, to obtain a fourth fitness value; the maximum fitness value among the fourth fitness values and the corresponding position of the manta ray in the second manta ray population are respectively used as the fourth global optimal fitness and the fourth global optimal position; the position matrix of each manta ray in the second manta ray population updated in the previous round of iteration is updated again according to the fourth global optimal fitness and the fourth global optimal position; after the update is completed, the second current iteration number is increased by 1 and the next round of iteration is entered; S435. When e′4≥e3′, stop the iteration and obtain the second final global optimal position; otherwise, continue the iteration until e′2≥e1′; use the second final global optimal position as the optimized purchase time point set; perform the purchase operation according to the optimized purchase time point set, and when the inventory forecast statistical cycle ends, calculate the total inventory cost to obtain the optimized inventory cost data; When the optimized inventory cost data is less than the inventory cost threshold, the optimized purchase time point set is used as the final purchase time point set; otherwise, return to S434 and continue to iterate until the optimized inventory cost data is less than the inventory cost threshold.
9. A system for implementing the dynamic inventory forecasting and optimization method according to any one of claims 1 to 8.
10. Application of the dynamic inventory forecasting and optimization method according to any one of claims 1 to 8 in a takeaway supermarket.
Citation Information
Patent Citations
Inventory optimization method, device, computer equipment and storage medium
CN113822610B