Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 6, No. 1, 2023 15 Research and Analysis of Vegetable Pricing and Replenishment Decisions Chunli Jiang *, Guo Chen College of Mathematics and Science, Chengdu University of Technology, Chengdu, 610059, China * Corresponding author: Chunli Jiang (Email: 2229137093@qq.com) Abstract: This paper uses LSTM to conduct a prediction study on the PS dataset to establish a revenue maximization optimization model by limiting the actual cost of a category that fluctuates within 10% of two adjacent days, using seven-day revenue as the objective function, and using the actual daily supplemental cost of each category as the decision variable. Taking the unit cost profit of a category as a category, the ratio of seven-day total profit to seven-day total supplemental cost, and based on cost-plus pricing, the cost price of an individual product for the next seven days can be estimated based on the unit cost profit of the corresponding category, so as to further estimate the pricing as the basis for pricing decisions. The Monte Carlo method is used to optimize the optimization objectives within different profit fluctuation percentage intervals using genetic algorithm, with a view to providing some implications for forecasting research in other fields. Keywords: LSTM; Genetic Algorithm; Monte Carlo; Optimization Models. 1. Introduction With the rapid development of the logistics industry, the variety of vegetables in supermarkets far beyond the ancient times, the origin is not the same [1]. But vegetables fresh goods short shelf life, quality with the increase in time and deterioration, most varieties such as the day not sold, the next day can not be sold this problem has always existed in the market operation [2]. Therefore, in order to reduce the loss of the best-selling products, supermarkets need to be replenished every day to make decisions is very important [3]. In terms of replenishment, superstores usually carry out purchase transactions from 3:00-4:00 a.m., and need to make replenishment decisions for each vegetable category on the same day based on the sales data of previous days, without knowing the exact single product and purchase price [4]. In terms of sales pricing, vegetables are generally priced on a "cost-plus pricing" basis, with discounts usually applied to goods that are damaged or have deteriorated in quality. From the supply side, vegetables are available in abundance from April to October, and the large amount of vegetables available makes the cost of vegetables fall, so it is important to utilize the sales space in supermarkets and maximize the market demand [5]. Under the constant change of market supply and demand, shopping malls need to consider the shelf life of vegetables, the rational use of sales space, and strive to get the maximum benefit of the situation to analyze the correlation between different categories of vegetables or different single products, to formulate the total amount of replenishment and pricing strategy is the way of survival of the superstore [6]. 2. Source of Data The dataset used in this paper is derived from the 2023 Higher Education Society Cup Mathematical Modeling Competition C questions. According to the VP Dataset, analyzing the line graphs of vegetables between different categories and items, then calculate the Spearman coefficients, and carry out the P-test, and finally give the correlation results between different categories and different items. 3. Analysis of Different Categories of Vegetables 3.1. Preprocessing of Data The dataset gives the product information of six vegetable categories distributed by a superstore and the sales flow details of each product of the superstore from July 1, 2020 to June 30, 2023, merging the same information of the two annexed tables and making a line graph of the total monthly sales volume Qi of each category. Figure 1. Folded trend charts between species Figure 1 lists the folded trend graph of total monthly sales of cauliflower and foliage and eggplant, respectively. There is a clear positive correlation between the total monthly sales of cauliflower and foliage, and a clear negative correlation between the total monthly sales of cauliflower and foliage: the simultaneous increase and decrease in sales of cauliflower and foliage under the passage of time, and the opposite trend in sales of cauliflower and eggplant. 3.2. Analysis between Different Individual Products of Vegetables Figure 2. Folded Trend Chart Between Individual Items 16 The total monthly sales volume between individual items in different categories also showed correlation. As shown in Figure 2, in the same category, the sales volume of each item shows cyclical changes, such as broccoli, broccoli with green pedicel and purple cabbage in cauliflower category show peak sales in August-October and January- March of the following year, and eggplant, eggplant with green pedicel, eggplant with round pedicel, eggplant with flower in eggplant category show good sales in January- March and June-August of each year, and the sales volume is lower than that in the same period of time in September- November. As shown in Figure 2, the total monthly sales of each item in the same category are positively correlated, such as broccoli and green cauliflower in the cauliflower category, which show an increase in sales in July-September and a decrease in October-December of the same year; such as purple eggplants and green eggplants in the eggplant category, which show an increase in sales in March-June of the same year, reaching a peak in June, and then a decrease in July- October, and then drop to the lowest level. 3.3. Correspondence Analysis Correspondence analysis, also known as correlation analysis and R-Q factor analysis, is a newly developed technique of statistical analysis of multivariate dependent variables in recent years, which reveals the links between variables by analyzing the interaction summary table composed of qualitative variables. It can reveal the differences between categories of the same variable and the correspondence between categories of different variables [7]. Alternatively, correlation analysis is the discovery of links between different goods (items) in a transaction database. Correspondence analysis of different types of vegetables in different months was analyzed to obtain a correspondence analysis table in Table 1. Table 1. Calculated results Singular value Principal inertia Cardinality Contribution rate Cumulative contribution rate 0.156581543 0.02451778 3849.094598 0.652228016 0.652228016 0.088439592 0.007821561 1227.922346 0.208071102 0.860299118 0.053940025 0.002909526 456.7722788 0.077399936 0.937699054 0.041461678 0.001719071 269.8803088 0.045731144 0.983430198 0.024957409 0.000622872 97.7859492 0.016569802 1 1.16784E 16 1.36384E 32 2.14112E 27 3.62813E 31 1 Table 1 shows that 86.03% of the total chi-square statistic can be illustrated by the first two dimensions, which represent the relationship between the rows and columns of points, and the corresponding analytical plots of the broad categories are given in the scatterplot of the same coordinate system for the 6 sample points and the 12 variable points as shown in Figure. 3. Figure 3. Folded trend chart between individual items In general, the categorization of different variables falling in roughly the same area in the same direction from the origin (0,0) of the graph is associated with each other. The closer the scatters are to each other, the more obvious the tendency of association is; the farther the scatters are from the origin, the more obvious the tendency of association is. From the correspondence analysis chart, we can see that there is a certain correlation between different categories and different months: leafy and cauliflower vegetables are closer to the months of July, August and September; tomato vegetables are closer to the months of May and June. This is also confirmed in the time series trend chart [8]. The sales volume of leafy and cauliflower vegetables will reach its peak in August and September, and the sales volume of eggplant vegetables will reach its peak in May and June. This can further illustrate that the sales volume of different categories of vegetables has a certain periodicity in the distribution of time. 3.3.1. Calculation of Spearman's Correlation Coefficient and Explanation of the Test Correspondence analysis and calculation of Spearman's correlation coefficient for each category and testing its significance. Sorting the data: First, the monthly total sales for each category are sorted in ascending order and each category is assigned a rank. The rank indicates the relative position of each category in the overall data set. If there are multiple identical observations, they can be assigned an average rank. Fall difference calculation: For each pair of categories and their total monthly sales, calculate the difference in rank between the two categories (e.g., ∆ ), where is the rank of the first category and is the rank of the second category. The data were transformed into ordinal variables to calculate the Spearman coefficients [9]. Calculation of Spearman's coefficient: Since the values are non-numerical, the original data , is not used directly, but the rank , of the data is used instead of , in the formula (1) of Spearman's correlation coefficient, where the values of and are the ranks. The range of values is limited to 1 ∼ . Equation for calculating Spearman's correlation coefficient: 1 6∑ Where, is Spearman's coefficient, is sample size: ∑   ∑   3.3.2. Significance Test Null Hypothesis: The null hypothesis is that there is no significant correlation between the two variables (P= 0). P-value Calculation: Using the nature of the distribution of the Spearman's correlation coefficient, the probability of 17 observing the Spearman's correlation coefficient or the more extreme case under the null hypothesis is calculated (the P- value). the P-value indicates the evidence for rejecting the null hypothesis. Significance Level Selection: A significance level (usually 0.05 or 0.01) is selected to indicate the extent to which the null hypothesis is willing to be rejected. Decision-making: Based on the comparison of the p-value to the significance level, a decision can be made whether to reject the null hypothesis. If the p-value is less than the level of significance, the null hypothesis is rejected as there is a significant Spearman correlation between the two variables; if the p-value is greater than the level of significance, the null hypothesis cannot be rejected, indicating that there is not enough evidence to support the existence of a significant correlation. For between individual items, the amount of sales data for some of the individual items is zero, there is no sales record for that part of the item and this data may lead to limitations in the analysis because it is not possible to take into account all the observations. Therefore, this sales data cannot be used as a basis for correlation analysis. 3.3.3. Correlation Results Across Categories Results of Spearman's coefficient between categories can be shown in Table 2. Table 2. Spearman's coefficient table Spearman's coefficient Category Cabbage Foliage Peppers Eggplant Mushrooms Aquatic Roots Category Cabbage 1 0.69472 0.31017 0.07619 0.46229 0.42677 Foliage 0 1 0.48777 -0.04324 0.57812 0.44788 Peppers 0 0 1 -0.16963 0.49035 0.31634 Eggplant 0 0 0 1 -0.44685 -0.46667 Mushrooms 0 0 0 0 1 0.66924 Aquatic Roots 0 0 0 0 0 1 Results of the P-value test can be shown in Table 3. Table 3. P-value test table P-value Category Cabbage Foliage Peppers Eggplant Mushrooms Aquatic Roots Category Cabbage 0 0 0.06562 0.65874 0.00453 0.00944 Foliage 0 0 0.00255 0.80226 0.00022 0.00616 Peppers 0 0 0 0.32265 0.0024 0.0615 Eggplant 0 0 0 0 0.00629 0.00412 Mushrooms 0 0 0 0 1 0.00001 Aquatic Roots 0 0 0 0 0 0 3.3.4. Combining Spearman's Coefficient and P-value Analysis among Categories According to the p-value table, the p-values of foliar, cauliflower, capsicum, tomato, edible mushrooms, and aquatic roots and tubers were all less than 0.05, which means that a significance level of 0.05 or lower rejects the evidence that there is no correlation between the two vegetable categories. This data provides enough support to prove that there is correlation between vegetable categories and it is not likely to be caused by random factors. Table 4 gives the results of the correlation between the categories: Table 4. Correlation results Strength of correlation Category Cabbage Foliage Peppers Eggplant Mushrooms Aquatic Roots Category Cabbage Positive correlation Positive correlation No correlation Positive correlation Positive correlation Foliage Positive correlation No correlation Positive correlation Negative correlation Peppers No correlation Positive correlation Negative correlation Eggplant Negative correlation Negative correlation Mushrooms Positive correlation Aquatic Roots There are a large number of single products, and those with correlation coefficients above 0.7 in absolute value and passed the test were screened out. The following figure shows the correlation coefficients and P-value test results between two items. Table 5 shows some correlation results between individual products. 4. Predictive Modeling 4.1. Constructing Regression Equations Constructing regression equations to control variables: regression analysis can be used to control for the effects of other variables in order to more accurately study the effect of the independent variable of interest on the dependent variable. This can have significant effects on experimental design and causal inference. Identifying critical factors: By analyzing the magnitude and significance of regression coefficients, it is possible to determine which independent variables are most important in explaining the variability of the dependent variable. This helps to identify key factors and optimize decision making. For a broad category, the total sales volume of the category on each day is regressed on the total cost and total profit of the category on that day. However, considering that the total 18 cost and total profit may interact with each other, a multivariate linear regression is performed by including ∗ as one of the independent variables. The coefficients of the results are tested. If the coefficient of interaction fails the t test, the interaction effect of the category is eliminated. In addition, various types of tests were performed on the model. These include. Table 5. Individual product relevance results Item Spearman's correlation P-value Correlation Baokang Alpine Cabbage Red Bell Pepper (portion) 0.82884 4.3053e 10/.000 Positive correlation Local Yellow Cabbage Yellow Cabbage (1) 0.82786 4.7063e 10 Positive correlation Chinese Cabbage Apricot Mushroom (1) 0.80024 4.7011e 09 Positive correlation Cordyceps (portion) Millet Pepper(portion) 0.80139 4.3049e 09 Positive correlation Spinach(portion) Green Pepper -0.76526 5.4544e 08 Negative correlation Lotus Root(portion) Amaranth -0.72271 6.4397e 07 Negative correlation Green stalks and flowers(portion) Small Bok Choy (1) -0.78642 1.3069e 08 Negative correlation Small Pepper (portion) Yunnan Lettuce -0.82606 5.5303e 10 Negative correlation Chinese Cabbage Cucumber -0.62373 4.1207e 10 Negative correlation Calculation of actual costs     ∗ 1 4.2. LSTM Model Predicts Sales Data Figure 4. Plot of the fit to the test set of macro eggplant vegetables LSTM is a variant of Recurrent Neural Network (RNN), which aims to solve the problem of gradient vanishing and gradient explosion in traditional RNN models. It introduces a gating mechanism to control the flow of information and memory in order to better capture the long-term dependencies in sequential data. Since the LSTM model is a rolling prediction, the predictions are repeated for the same day in different prediction rounds, and for each day's prediction, only the last round of prediction is extracted. As can be seen from the line graph comparing the real value and the predicted value with each other, there is not much difference between the real value and the predicted value in the localized area and in the whole, no matter whether it is micro or macro. Therefore, the prediction results are considered to be good. The RMSE of the prediction results for each test set is calculated, as shown in Figure 4. The mean square error is less than 0.1, which is considered to be very small. The prediction results can be considered good. Table 6. Table of Mean Square Errors by Category Category Cabbage Foliage Peppers Eggplant Mushrooms Aquatic Roots RMSE 0.0232 0.1062 0.0686 0.023 0.0383 0.021 The results of using the model to forecast sales by category from July 1 to 7, 2023, are shown in the Table 7 below: Table 7. Sales Forecast by Category for July 1-7, 2023 Dates Cauliflower Philodendron Capsicum Eggplant July 1, 2023 27.965345 144.30435 102.55486 21.815638 July 2, 2023 23.135353 107.14121 84.21254 20.033892 July 3, 2023 21.754042 85.639534 69.264435 11.709251 July 4, 2023 23.116005 125.72972 68.932312 13.687965 July 5, 2023 27.049213 142.81409 87.016083 18.419756 July 6, 2023 28.841722 180.80971 83.306435 18.588314 July 7, 2023 26.040621 174.93515 91.785805 23.701694 From the table above, as the daily sales volume of each category, and the forecast can be considered category all sold, in the case of vegetable loss, the actual daily replenishment needs to be calculated to calculate the category weighted loss ratio .   ∗ 19 Calculate the depletion weight of j individual items in categories where with the following the day's replenishment for the i-th category, is the day's sales volume, and is the category-weighted attrition rate. Forecast of replenishment by category from July 1 to 7, 2023 can be shown in Table 8. Table 8. Forecast of replenishment by category from July 1 to 7, 2023 Dates Cauliflower Philodendron Capsicum Eggplant July 1, 2023 31.37112705 164.8748687 111.5461981 23.29621232 July 2, 2023 25.95291059 122.4141402 91.59574365 21.39354355 July 3, 2023 24.40337552 97.84741018 75.33708676 12.5039294 July 4, 2023 25.93120628 143.6524337 74.97584539 14.61693391 July 5, 2023 30.34342318 163.1721728 94.64508293 19.66986006 July 6, 2023 32.35423433 206.584051 90.6101973 19.84985768 July 7, 2023 29.21199899 199.8720752 99.83298289 25.31027035 The Category Profit Equation: ∗ ∗ Table 9. Profit Equation by Category Category Multiple regression equation Cabbage 3.548 0.106 0.002 Foliage 52.743 0.035 0.346 Peppers 19.149 0.323 0.0002 3 Eggplant 0 1.001 0.000 0.176 0.0050.5 Mushrooms 3.567 0.100 0.144 0.0016 Aquatic Roots 2.355 0.131 0.13 0.0006 Bringing the data from Table 8 into the category profit equations yields the profit equations for each category in Table 9. Model Assumptions: The change in cost of goods purchased on the requested date does not exceed 10%, with reference to the cost of goods purchased for each item in the previous 30 days. Under the above assumption, the cost of each category will not change greatly in 30 days, so when we take the pricing decision, combined with the regression equation in Table 8, we take the percentage change of the cost of two consecutive days is less than or equal to 10% as a restriction, and take the daily cost of each category as an independent variable, and then plan the decision of the total profit of the six categories in seven days, and optimize the goal by using genetic algorithms to get the maximum profit of the sales and the replenishment cost of each category per day at this point in time. Maximum profit calculation results can be shown in Table 10. Table 10. Maximum profit calculation results Cost of a single day's entry Category Cabbage Foliage Peppers Eggplant Mushrooms Aquatic Roots Cabbage Forecast date July1,2023 34.733317 267.83444 151.33050 97.22922 294.4417 222.73246 July2,2023 169.74469 519.50887 301.00805 5.53180 5.53180 957.163783 July3,2023 10.48697 899.96361 39.99202 41.94244 41.94244 204.1115351 July4,2023 101.6112502 747.5038373 298.8571996 391.7158922 391.7158922 5.949549359 July5,2023 38.89563269 731.2040216 440.0664282 28.88903016 28.89903016 72.63728506 July6,2023 173.0524197 347.9327264 409.5797489 431.1020642 431.1020642 4038340015 July7,2023 633.476414 1338.924458 1026.172588 53.57794217 53.57794217 4535995501 total profit 1286.734086 55.2167469 2271.577994 -18.68620995 -18.69620995 176.2575487 Unit Cost Profit 1.1073 0.1143 0.85 0.01714 -0.01714 0.0922 Aggregate 5473.52035 5. Monte Carlo Modeling For different profit fluctuation intervals, we use Monte Carlo method combined with Genetic Algorithm to find the best optimized profit fluctuation interval among different profit fluctuation intervals, which is used as the basis for pricing based on the cost of the product, and combined with 20 the cost plus pricing, we can get the day's pricing interval, and then pricing in accordance with the actual situation. According to the previous section, there is a significant negative correlation between sales volume and profit. According to the data analysis, most of the single product profit fluctuation lies between [0.5, 2.0], then we use Monte Carlo simulation to find out different upper and lower bounds of the optimization results for comparison, and select the optimal optimization results and its profit fluctuation range. Table 11 shows some of the optimization results and profit float intervals. Table 11. Total daily profit margin for various floating ranges Floating range 0.7-1.1 0.7-1.2 0.7-1.3 0.7-1.4 0.8-1.1 0.8-1.2 0.8-1.3 0.8-1.4 Total daily profit 381.04793 391.19271 489.83779 446.81756 416.32817 424.4894 498.28882 475.59768 When the profit fluctuation interval for [0.8,1.3] when the maximum profit of 498.2882 yuan, to get at this time the sale of single product replenishment, 24-30 days of single product unit average profitability, can be considered as a single product unit profit and H product for the prediction of single- product unit profit, if you get the prediction of the day of the replenishment cost of the projected pricing can be expected to get, the results are shown in Table 12. Table 12. Replenishment Costs by Item Item Broccoli Zijiang Qingdian Scattered Flowers Spinach Spinach (portions) Chinese flowering cabbage Sweet potato tip 24-30 Average daily profit margin 1.675983158 1.457332118 0.872846325 0.944787322 0.293665469 0.71996731 Intake 19.83048 19.75666 19.37032 19.95297 0.0079 19.23071 Item Mullein (servings) Cabbage (round cabbage most commonly found in Chinese medicine) Shanghai Youth Baby Chinese cabbage (mini-sized variety) Chrysanthemum coronarium Amaranth greens (genus Amaranthus) 24-30 Average daily profit margin 1.636881234 0.80096351 1.299578272 1.662855249 0.628252887 0.500451364 Intake 9.96809 0.0021 9.90703 9.89451 0.00746 9.36791 Item Yunnan lettuce Yunnan Lettuce (Servings) Yunnan oilseed rape (Brassica campestris L.) Yunnan oilseed rape (Brassica campestris L.)(Servings) Brussels sprouts (Brassica oleracea var. botrytis) Red Bell Peppers (2) Ginger 24-30 Average daily profit margin 0.787794526 0.513401896 0.855587941 0.990759419 0.463297622 0.979278144 Intake 9.14533 0.0012 9.78084 0.00843 0.00331 9.91964 Item King cobra or chili (Naga jolokia) King cobra or chili (Naga jolokia) (Servings) Colorful Peppers (2) Green & Red Pepper Combo (Servings) Green pepper (portion) Green pepper (1) 24-30 Average daily profit margin 1.120210061 1.24788757 1.350403849 1.948377314 1.175345037 0.597013218 Intake 9.98007 9.93355 9.8791 9.99918 9.73923 0.00819 Item Small wrinkled skin (portions) Green Eggplant (1) Round Eggplant (2) long term eggplant Purple Eggplant (1) Purple Eggplant (2) 24-30 Average daily profit margin 0.904042471 1.026146175 1.189148065 1.817399791 2.154560671 1.098020829 Intake 9.9397 0.0054 9.93381 9.96833 9.84222 0.00391 Item Cordyceps (portions) Seafood Mushroom (Packet) Enoki Mushroom (box) Agaricus bisporus (box) Xixia Mushroom (1) Fresh fungus (portion) Crab 24-30 Average daily profit margin 0.668644419 0.795 0.419713489 1.620609791 1.197507848 0.98964613 Intake 9.64951 9.93991 9.85705 0.00038 9.5309 9.95582 Item Kogua (1) Kogua (2) Red Lotus Root Scallops Honghu Lotus Roots Net Lotus Root (1) Water chestnut 24-30 Average daily profit margin -1.133989908 0.199427717 0.637293847 -0.983556159 1.383865829 2.050333598 Intake 0.00445 9.90949 0.0013 0.00638 0.00358 9.76867 Other data to be considered in this paper: comprehensive supplier product evaluation, data on the nature of economics, customer purchase feedback data, inventory data. Supplier data includes product quality assessment, historical supply reliability, price information, and supply capability of different suppliers. By analyzing such data to obtain more cost-effective vegetable products to maximize the profit of the supermarket. Customer feedback data includes customer satisfaction, preference, complaints and purchase history of different vegetables. Based on these data, different vegetables can be scored and ranked. Pricing decisions can be optimized so that replenishment and pricing strategies can be better adjusted. Data on the economics of the product can be used to better optimize sales and pricing models. Inventory data tracks inventory levels and turnover. Because the data in the model may deviate from reality, this data can be used to better manage inventory, reduce slow- moving and out-of-date items, and optimize the model. 6. Conclusion Using time series charts and Spearman's correlation coefficient to study the correlation between the sales volume of different individual products and categories, an LSTM model is built to predict the sales volume from July 1 to 7, 2023, and a genetic algorithm is used to build a maximum optimization model to make a pricing decision using the actual cost of replenishment of each category on a daily basis as the decision variable. The LSTM model can efficiently deal 21 with long-term time series, which can effectively utilize the time series data and the correlation term in regression analysis. The data in the validation set above can be fitted well. At the same time, the LSTM network can combine short-term memory and long-term memory through the gate, which solves the problem of gradient disappearance to a certain extent. When the time series is too long, this model can not only obtain the information of the previous time, but also take into account the role of the current factors. References [1] Mao Lisha. Research on Pricing Strategy and Production and Marketing Mode of Vegetable Wholesale Market under the Perspective of Supply Chain[D]. Central South Forestry University of Science and Technology, 2023. [2] Fang Li. Research on the pricing method of vegetable raw materials in college logistics[J]. College Logistics Research, 2021, (10):22-24. [3] Wei Danlin. Research on the risk and pricing of vegetable income insurance in Shandong[J]. Rural Economy and Technology,2021,32(02):69-70+160. [4] Zhao Y. Research on pricing of vegetable revenue insurance based on semiparametric Copula method[J]. Research on Agricultural Modernization,2019,40(02):308-315. [5] Sun Xiaolu. Vegetable price index insurance pricing based on policyholders' expectations[D]. Northeast University of Finance and Economics,2019. [6] Sun Xiaolu. Vegetable price index insurance pricing based on policyholder expectations[J]. Journal of Insurance Vocational College, 2018,32(04):22-28. [7] Zheng Yan. Analysis of the implementation status of vegetable marketing strategy in Dengta City[D]. Shenyang Agricultural University,2017. [8] Yang Dan. Design of vegetable supply chain based on CSA model [D]. South China University of Technology,2015. [9] Qian H,Yu Jusheng,Luo Qiang,Zhang Chen. Research on the integration of Shanghai vegetable supply chain for collaborative pricing[J]. China Agronomy Bulletin,2013, 29 (35): 386-390.