Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 13, No. 2, 2024 146 Research on the Optimization Strategy of Crop Planting Combining Dynamic Programming and Monte Carlo Simulation Hongda Chen1, *, Wenbo Li1 and Qikai Chen1 1School of Electrical Engineering, Xi 'an University of Technology, Xi’an, China *Corresponding author Abstract: This paper explores the optimization of crop planting strategies by combining dynamic programming with Monte Carlo simulation. In the multi-stage decision-making for planting optimization, we decomposed the optimal planting plans for crops from 2024 to 2030 into annual best planting plans. We established an objective function aimed at maximizing total profit, taking into account factors such as planting area, crop yield, sales price, and planting cost. A series of constraints were also introduced, including that the planting area should not exceed the cultivated land area and that the total crop production should not surpass the expected sales volume. By employing dynamic programming and greedy algorithm models, we utilized the PuLP linear programming library to define problems, add constraints, and invoke solvers to find the optimal solution. The model considered not only the planting costs and sales prices but also treated excess sales volume as waste. In the result analysis phase, we analyzed the cyclical changes in data across different years and observed that the total profit exhibited a certain fluctuation trend. We also conducted error analysis on the potential errors introduced by the greedy algorithm, running the model multiple times to verify the stability of the results and ensure the reliability of the model. Finally, we discussed the complementarity and substitutability between crops, which significantly impact the total income in the actual planting process. Keywords: Crop planting, dynamic programming, monte carlo simulation, optimization strategy. 1. Introduction The traditional approach to crop planting has often been based on empirical methods and historical data, which may not fully account for the complexities and uncertainties inherent in agricultural production [1, 2]. To address these limitations, we propose a novel approach that combines advanced mathematical programming techniques with stochastic simulation. Dynamic programming allows us to break down the complex, multi-year planting problem into a series of simpler [3], sequential decisions, each informed by the outcomes of the previous steps. Monte Carlo simulation [4], on the other hand, enables us to model and evaluate the impact of various uncertainties, such as weather fluctuations and market volatility, on the crop planting strategies. Our research begins with a thorough data preprocessing phase, utilizing Excel to visualize and analyze the existing arable land data in the North China mountain region. This phase is crucial for understanding the current state of land use and crop distribution, which forms the foundation for our subsequent optimization efforts. We then delve into the multi- stage decision-making process for planting optimization, establishing an objective function that maximizes total profit while adhering to a set of constraints that reflect real-world limitations and requirements. The constraints include not exceeding the cultivated area with crop planting, ensuring that total crop production does not surpass expected sales, and maintaining an appropriate balance in the planting area for different crops to avoid over- saturation or under-utilization of land resources. We also incorporate the concept of crop complementarity and substitutability, recognizing that certain crops can either compete for resources or benefit each other's growth, which in turn affects the overall agricultural output and profitability. We implement our dynamic programming and greedy algorithm models [5], using the PuLP linear programming library to define and solve the complex problem of crop planting optimization [6]. Our model evaluates planting strategies under different market conditions, considering both the costs of cultivation and the potential revenues from sales, including the treatment of excess sales volume as waste or discounted goods. 2. Data Preprocessing In the process of our research on crop planting strategies, data preprocessing has become an essential part of our work. We first utilized Excel to visualize the existing arable land data of the rural areas in the North China mountain region, clearly presenting the distribution of planting areas for different land types through pie charts. Subsequently, based on the crop types and planting land conditions, we created corresponding charts, which helped us gain a more intuitive understanding of the distribution of crops and the use of arable land. To gain a deeper understanding of the planting area of crops in different quarters, we used the 2023 crop planting data to display this information. Furthermore, we summarized the planting area and yield per acre of the same crops and visually presented them in the form of bar charts, which helped us analyze the relationship between crop yield and planting area. We also paid special attention to the correlation between crop planting area and yield per acre, analyzing the impact of the planting area of legumes and non-legumes on yield per acre through scatter plots. We found that after the planting area increased to a certain extent, the yield per acre reached its peak, and after exceeding this point, the yield per acre would actually decrease. In terms of total sales volume, we calculated the total sales 147 volume of each crop and compared them through bar charts, which helped us identify crops with high and low sales volumes. In addition, we conducted an in-depth analysis of the relationship between the planting cost and profit margin of each crop. By sorting and calculating the data from 2023, we obtained the average sales price and selling price for each crop. Combining the planting cost and sales price, we calculated the total cost and total profit for each crop, thereby deriving the profit margin. 3. Multi-stage Decision-Making in Planting Optimization First, the optimal planting scheme for crops in 2024-2030 was decomposed into the optimal planting scheme for each year. The planting plan of crops each year is relatively independent, but the planting plan of the previous year will have an impact on the planting plan of the following year, so dynamic planning is chosen. Then, according to the cultivation conditions, the crops are decomposed into food and non-food categories, and the greedy algorithm is used to find the optimal solution one by one. Finally, the optimal planting scheme of crops in the seven years from 2024 to 2030 is obtained. 3.1. Establishment of the Objective Function We set up the objective function as the maximum value of the total profit. The total production of the 𝑖 crop in that year was: 𝑒 βˆ‘ 𝑠 𝑦 𝑙 (1) Where, 𝑀 is the amount of cultivated land, and 𝑙 is the planting yield per mu of the 𝑖 crop on the 𝑗 cultivated land, in units of jin. Let 𝑓 be the sales generated by the 𝑖 crop, 𝑓 𝑒 𝑏 (2) Where, 𝑏 is the unit price of the i crop, and the unit is yuan/jin. Planting cost is: cost βˆ‘ βˆ‘ 𝑠 𝑦 π‘Ž (3) Where π‘Ž is the planting cost of the i crop on the j cultivated land, and the unit is jin/mu. In summary, the total profit of the objective function Z is π‘šπ‘Žπ‘₯ 𝑍 βˆ‘ 𝑓 cost βˆ‘ βˆ‘ 𝑠 𝑦 𝑙 β‹… 𝑏 βˆ‘ βˆ‘ 𝑠 𝑦 π‘Ž (4) 3.2. Constraints Constraint 1: The planting area of crops should not exceed the cultivated area. βˆ‘ 𝑠 𝑦 𝑑 , 𝑗 1,2,β‹…β‹…β‹… ,26 (5) Wherein, 𝑑 is the largest planting area of the 𝑗 -type cultivated land. Constraint 2: Total crop production per season cannot exceed expected sales. If the total output 𝑒 of the crop per season exceeds the expected sales 𝑐 , the excess part cannot be sold normally, which will cause a greater degree of loss, so the total output of the crop per season cannot exceed the expected sales: 𝑒 βˆ‘ 𝑠 𝑦 𝑙 𝑐 , 𝑖 1,2,β‹…β‹…β‹… ,15 (6) Constraint 3: The area of each crop in a single cultivated land should not be too small. Combined with Annex I and Annex II, it is obtained that the minimum area (A3) of the flat early field is 35 mu, and 35 mu of corn crops are planted in the flat early field of A3, and there is no vacancy of arable land in all other cultivated fields. Similarly, the number of acres of crops in the flat terrace is not less than 20 acres, and the number of acres of crops in the hillside is not less than 13 acres. 𝑠 35, 𝑗 1,2,β‹…β‹…β‹… ,6 𝑠 20, 𝑗 7,8,β‹…β‹…β‹… ,20 𝑠 13, 𝑗 21,22,β‹…β‹…β‹… ,26 (7) Constraint 4: Each crop should not be planted too widely each season. Observing Annex II, it can be found that only one crop is planted in the same plot (for example, A1 flat early field, B1 terrace and C5 only grow wheat). Therefore, it is stipulated that no more than three crops can be grown on the same cultivated land. The decision variable 𝑦 is applied. βˆ‘ 𝑦 3, 𝑗 1,2,3,β‹…β‹…β‹… ,26 (8) Constraint 5: Each crop can not be planted in the same plot of land. First, build the indicator variables π‘š 𝑑 and 𝑛 𝑑 . Since the same crop cannot be grown on the same plot for two consecutive years, the relationship between π‘š 𝑑 and 𝑛 𝑑 is: 𝑛 𝑑 1 0οΌŒπ‘š 𝑑 1 1 𝑛 𝑑 1 1οΌŒπ‘š 𝑑 1 0 (9) After the feasibility condition 𝑛 𝑑 is introduced, the above objective functions and constraints need to be modified. The output is modified to: 𝑒 βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… 𝑙 , 𝑖 1,2,β‹…β‹…β‹… 15 (10) The planting cost is revised as: cost βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… π‘Ž (11) The objective function is modified to: 148 π‘šπ‘Žπ‘₯ 𝑍 βˆ‘ 𝑒 𝑏 cost βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… 𝑙 β‹… 𝑏 βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… π‘Ž (12) Constraint 6: Plant pulses at least once in three years from 2023. Since the planting of soybeans produces legumes in the soil that are conducive to the growth of other crops, every plot (including greenhouses) is required to plant legumes at least once in three years from 2023. To sum up, this paper establishes a multi-stage mathematical programming model by determining objective function, constraint condition, decision variable and time variable t. Since pulses are planted at least once in three years, the model for 2024 does not need to consider constraint 6, but the model for 2025 and later years does. 3.3. Establishment of the Model The mathematical planning planting model for 2024 crops is as follows: π‘šπ‘Žπ‘₯ 𝑍 βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… 𝑙 β‹… 𝑏 βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… π‘Ž (13) 𝑠. 𝑑. 1 ⎩ βŽͺ ⎨ βŽͺ ⎧ βˆ‘ 𝑠 𝑦 𝑛 2024 𝑑 , 𝑗 1,2,β‹…β‹…β‹… ,26 𝑒 βˆ‘ 𝑠 𝑦 𝑛 2024 β‹… 𝑙 𝑐 , 𝑖 1,2,β‹…β‹…β‹… ,15 𝑛 2024 0, π‘š 2023 1 𝑛 2024 1, π‘š 2023 0 (14) 𝑠. 𝑑. 2 ⎩ βŽͺ ⎨ βŽͺ ⎧ 𝑠 35, 𝑗 1,2,β‹…β‹…β‹… ,6 𝑠 20, 𝑗 7,8,β‹…β‹…β‹… ,20 𝑠 13, 𝑗 21,22,β‹…β‹…β‹… ,26 βˆ‘ 𝑦 3, 𝑗 1,2,β‹…β‹…β‹… ,26 (15) The mathematical planning planting model for crops in 2025 and later years is as follows: π‘šπ‘Žπ‘₯ 𝑍 𝑑 βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… 𝑙 β‹… 𝑏 βˆ‘ βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… π‘Ž (16) 𝑠. 𝑑. ⎩ βŽͺβŽͺ ⎨ βŽͺβŽͺ ⎧ βˆ‘ 𝑠 𝑦 𝑛 𝑑 𝑑 , 𝑗 1,2,β‹…β‹…β‹… ,26; 𝑑 2025,β‹…β‹…β‹… ,2030 𝑒 𝑑 βˆ‘ 𝑠 𝑦 𝑛 𝑑 β‹… 𝑙 𝑐 , 𝑖 1,2,β‹…β‹…β‹… ,15; 𝑑 2025,β‹…β‹…β‹… ,2030 𝑠 35, 𝑗 1,2,β‹…β‹…β‹… ,6 𝑠 20, 𝑗 7,8,β‹…β‹…β‹… ,20 𝑠 13, 𝑗 21,22,β‹…β‹…β‹… ,26 βˆ‘ 𝑦 3, 𝑗 1,2,β‹…β‹…β‹… ,26 (17) Then, we set up the mathematical model of rice, vegetable and edible fungus crop planning problem, which also includes the objective function and constraint conditions. 3.4. Model Solving In the model solving stage, we use Python programming language, combined with Jupyter Notebook, a powerful interactive computing environment, to implement our dynamic programming and greedy algorithm model. We first define decision variables that represent the choice to grow a particular crop on a particular plot. Next, we construct the objective function to maximize the total profit, i.e. the total selling price minus the total cost. In addition, we have included a series of constraints to ensure the viability of the planting program, including that the crop area cannot exceed the cultivated area and the total crop production cannot exceed the expected sales volume. To solve the model, we use the linear programming library PuLP, which allows us to define linear problems, add constraints, and invoke solvers to find the optimal solution. Our model takes into account not only the cost of growing the crop and the selling price, but also the way in which the excess sales volume is treated as waste in case one and sold at half price in case two. In this way, we are able to evaluate planting strategies under different market conditions. After solving the model, we obtained the optimal planting scheme for each year from 2024 to 2030. The plans detail how each crop will be planted on each piece of land, including the area planted and the expected yield. We further analyzed these results to assess the impact of different planting strategies on total profitability. In the result analysis stage, we first analyzed the periodic changes of the data and found that the total profit showed a certain fluctuation trend in different years. This may be due to changes in planting costs, selling prices and market demand. We also perform error analysis to evaluate the errors that the greedy algorithm may introduce in the solution process. By running the model several times, we verify the stability of the results and ensure the reliability of the model. 4. Crop Complementarity and Substitutability In the actual planting process, there are certain substitutability and complementarity between crops, which will affect the total income. Alternative crops compete with each other for land, and complementary crops promote the growth of another crop to increase yields. Therefore, it is necessary to weigh the planting area of different crops and consider the impact of crops of the same plot type. In addition, in the market, there is a relationship between the pre-sale of crops and the yield, sales and planting cost per mu, which can reflect the scientific rationality of resource utilization and the law of market fluctuation. 4.1. Analysis of Crop Substitutability Substitutability is manifested as the increase of planting area of one crop will lead to the decrease of planting area of another crop, so the substitutability constraint model is proposed. Substitution constraint model: Substitution can be represented by setting the constraint conditions of land resources. Take corn and wheat for example (the numbers of corn and wheat are i=6,7 respectively), two alternative crops cannot be planted in the same cultivated land at the same time, and the constraint conditions are expressed as: 𝑦 𝑑 𝑦 𝑑 1, 𝑗 1,2, β‹― ,26 𝑦 𝑑 , 𝑦 𝑑 0 or 1, 𝑗 1,2, β‹― ,26 (18) Among them, 𝑗 represents 26 cultivated land such as flat dry land and terraced fields. 4.2. Analysis of Crop Complementarity Complementarity: Complementarity shows that the nutrient elements of one crop can promote the growth of 149 another crop or enhance the resistance to diseases and pests, thereby improving crop yields and increasing earnings. Legumes, for example, have the ability to fix nitrogen, which can increase soil effort and facilitate the cultivation of other crops. Complementarity model: To achieve complementarity, rewards can be added to the objective function. That is, if two complementary crops are planted on the same arable land, they can bring benefits. This synergistic effect can be realized by setting the correlation coefficient h, which is concretely expressed as an additional reward term in the objective function. There are two crops 𝑖 and 𝑖 in cultivated land j, and the two crops are complementary, and the correlation coefficient between them is β„Ž , then the income of the two crops will be a part more than the original income, let the original income is Z_0, and the income after planting complementary crops is Z, Z can be expressed as: 𝑍 𝑍 βˆ‘ βˆ‘ βˆ‘ β„Ž 𝑦 𝑠 (19) 4.3. Construction of Mutually Exclusive Complementary Matrix According to the crop planting situation in 2023, crops can be divided into legumes, cereals, vegetable crops and fungus crops. In order to construct a scientific mutually exclusive complementary matrix, the characteristics of the above crop types were analyzed separately. Soil containing rhizobacteria of legumes is good for crop growth, and legumes have the ability to fix nitrogen, which can improve soil nutrients, which is good for the growth of other crop types. There are complementarities between legumes and other types of crops that can increase crop yields and yields. However, there is substitution between legumes and legumes, and they will compete for land and fertility resources, and there is a competitive relationship and mutual exclusion. Grain crops have similar growth environment. If two kinds of grain are planted in the same arable land at the same time, their similar demand for soil and nutrients will lead to competition for limited resources, which will reduce soil fertility, which is not conducive to crop growth and development, and reduce yield and income. Therefore, cereal crops should not be planted in the same arable land at the same time, and crop rotation can be adopted to reduce the consumption of soil fertility. Vegetable crops can maintain soil fertility by rotating with other crops, so vegetable crops and other crops are complementary. The quality and yield of crops can be improved through reasonable and scientific crop rotation methods. However, vegetable crops need to compete with each other for light, water and land resources, and there is a competitive relationship, and the complementarity between them is weak. Fungus crops grow in a special environment, they grow on different cultivation media, so there is no competition with plant crops, with good complementarity. Fungal crops can use agricultural by-products (such as straw, straw) to achieve adaptation with most crops, suitable for rotation. The Seaborn model in python was used to make a display diagram of complementarity and substitution between crops, as shown in Fig. 1. Figure 1. Complementary and substitutability display of crops 4.4. Results Analysis python is used to obtain the total profit per year from 2024 to 2030 and the optimal planting strategy from 2024 to 2030. Taking food crops as an example, the optimal annual planting plan of food crops is shown in Fig. 2. By observing the optimal planting plan each year, it can be found that wheat and barley have strong substitution. When the planting area of wheat is large, the planting area of barley is almost not changed. The substitution of corn and sorghum is weak, and the planting area of the two is similar in many years. By observing soybeans from 2023 to 2030, it can be seen that soybean planting meets every three years, although some land types of soybeans are the same as food crops, but they do not compete with food crops, so they are complementary to food crops. In line with the natural growth law of crops, the data is reliable. Figure 2. Soybean planting area in 2023-2030 5. Conclusion Rotary kiln is also used in the production of saloon with production capacity by burning specific clay soil that possesses adequate quantity of silica, alumina, and iron oxides. The external diameter of the kiln is. The main purpose of a rotary kiln hydrolyser is to convert olive pits into char fated to the production of activated char. The capacity of plant is about of wet olive pit, distribution of pyrolysis products as function of the process temperature References [1] Zhang C, Di L, Lin L, et al. Machine-learned prediction of annual crop planting in the US Corn Belt based on historical 150 crop planting maps[J]. Computers and Electronics in Agriculture, 2019, 166: 104989. [2] Oladosu Y, Rafii M Y, Abdullah N, et al. Principle and application of plant mutagenesis in crop improvement: a review[J]. Biotechnology & Biotechnological Equipment, 2016, 30(1): 1-16. [3] Eddy S R. What is dynamic programming? [J]. Nature biotechnology, 2004, 22(7): 909-910. [4] Raychaudhuri S. Introduction to monte carlo simulation [C]//2008 Winter simulation conference. IEEE, 2008: 91-100. [5] Barron A R, Cohen A, Dahmen W, et al. Approximation and learning by greedy algorithms[J]. 2008. [6] Dantzig G B. Linear programming[J]. Operations research, 2002, 50(1): 42-47.