Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 10, No. 3, 2024 54 Crop Planting Strategy based on Greedy Algorithm and Monte Carlo Simulation Haoxu Miao * Shandong University of Science and Technology, Jinan, Shandong, 250031, China * Corresponding author Email: 205511845@qq.com Abstract: Crop cultivation is a complex process influenced by a multitude of environmental and market factors. To navigate these complexities and enhance profitability, this paper presents an innovative crop planting strategy. The strategy employs a combination of a greedy algorithm and Monte Carlo simulation techniques to optimize the allocation of crop cultivation. By analyzing historical planting and sales data, the proposed method aims to predict and maximize overall profitability. This approach not only considers immediate conditions but also incorporates a probabilistic assessment of various outcomes, providing a robust framework for decision-making in agricultural planning. Keywords: Monte Carlo Simulation; Greedy Algorithm; Floating Parameters. 1. Introduction 1.1. Problem Background In a rural area of the mountainous region in North China, the utilization of arable land resources faces many challenges. The geographical environment of the village is complex, and the climate conditions are special, allowing for only one season of crop cultivation per year. The village has six types of arable land, including flat dry land, terraced fields, hillside land, irrigated land, ordinary greenhouses, and smart greenhouses. The crop planting plan for the village needs to take into account factors such as soil fertility recovery, crop growth cycles, convenience of field management, and production benefits [1]. A reasonable planting strategy can not only improve production benefits but also effectively reduce planting risks, promoting the sustainable development of the rural economy. Considering the limited and diverse nature of arable land resources, formulating an optimized planting plan is crucial for achieving the long-term economic goals of the village. 1.2. Problem Description Combining the existing arable land and crop cultivation situation in the village, as well as the crop planting and related statistical data from 2023, this paper needs to establish a mathematical model to analyze the following issues: Considering the expected sales volume, yield per acre, planting costs, and sales prices of different types of crops, the optimal planting plan for the village from 2024 to 2030 needs to be determined under the influence of factors such as climate and market conditions. 2. Problem Analysis 2.1. Model Assumptions (1) Scheme One: Utilization of the 51 Microcontroller Assuming that the future expected sales volume, planting costs, yield per acre, and sales prices of various crops remain stable relative to 2023. (2) Assuming that crops are sold in the season they are harvested, and the production of each crop in each season equals the sales volume as long as the total production does not exceed the expected sales. Therefore, the total production of each crop in 2023 is the expected sales volume. (3) Assuming that 2024 is the first year, and the known year of 2023 is the zeroth year. (4) Assuming that the optimal planting plan refers to the plan that yields the maximum profit while meeting the constraints. 2.2. Problem Analysis Figure 1. Overall flowchart A crop planting planning model for 2024-2030 needs to be established based on the fluctuation of various factors. Since factors such as the expected sales volume, yield per acre, cost price, and sales unit price of crops are influenced by seasons, market, and other factors, the fluctuation of these factors cannot be precisely known. As shown in Figure 1, the model established in this paper is a nonlinear programming model with only one optimization objective: to maximize the profit from the current season's crops. This paper uses Monte Carlo 55 simulation to estimate and optimize the uncertainty in complex systems through a large number of random samples, thereby finding the best decision-making strategy. Based on the data provided in the problem, it is necessary to first define the probability distributions of sales volume, yield per acre, planting cost, and sales price. Random samples are generated, and the total profit for each sample is calculated. Finally, the distribution of profits is assessed, and a planting plan that maximizes expected profit and is acceptable in terms of risk is selected. The model is then solved using a greedy algorithm. 3. Data Preprocessing 3.1. Distribution of Existing Cultivated Land Types By analyzing the types of cultivated land, the proportion of each type of cultivated land can be determined, which helps to better plan planting plans. It is known that there are six types of cultivated land in this village, including flat dry land, terraced fields, hillside land, irrigated land, ordinary greenhouses, and smart greenhouses. Figure 2. Pie chart of distribution of existing cultivated land types The total arable land area of the village is 1,213 mu, of which there are 34 open fields totaling 1,201 mu; and 20 greenhouses totaling 12 mu. Visualizing the above data into a pie chart, as shown in Figure 2, it can be seen that terraced fields account for the largest proportion of the total arable land area, at 51.03%; smart greenhouses are the least. 3.2. Distribution of Different Crop Planting Ratios The village grows three types of crops, namely grains, vegetables, and edible fungi, with both grains and vegetables including legumes. As shown in Figure 3, which displays the proportion of each type of crop in the total planting area, grains account for the largest planting area, at 56.97%; the planting area for legume vegetables is the smallest, at 2.01%. Figure 3. Pie chart of different types of crop proportions The three major categories of crops each consist of various subcategories, with a total of 40 different types. Figure 4 illustrates the planting area for each subcategory of crops in 2023. Figure 4. The planting area of each small crop variety in 2023 56 From the chart, it can be seen that the planting area of wheat in 2023 is the largest, at 222 mu, followed by millet and soybeans, indicating that common grain crops had a larger planting area in 2023. The planting area is smaller for vegetable crops, which have higher requirements for temperature, moisture, and soil conditions. 3.3. Screening and Sequencing of Dominant Crops By knowing the yield per mu, cost price, and selling price for each crop per season, one can calculate the profit per mu for each crop. Analyzing the yield per mu and profit for different crops can help identify the crops with the highest yield and profit, which are considered dominant crops. This analysis is of great significance for designing subsequent planting plans. By analyzing Figure 5, it can be concluded that among the 41 crops cultivated in the village, cucumbers have the highest yield and profit per mu, with a yield of 40,522 jin and a profit of 292,150 yuan per mu; next is the golden oyster mushroom with a profit of 284,500 yuan per mu; soybeans and rice have lower profits, at 2,505 yuan per mu and 2,820 yuan per mu, respectively. Therefore, to meet the requirements of the problem, cucumbers and golden oyster mushrooms, which have high yield and profit, can be prioritized for planting. Figure 5. The yield per mu and profit of different types of crops From Figure 6, it is evident that wheat has the largest planting area of 167 mu, but the yield per mu is only 2,280 jin. Similarly, soybeans and millet also fall into the category of crops with large planting areas but low yields. Cucumbers have a yield of 40,500 jin per mu, with a planting area of only 0.9 mu, belonging to the category of crops with small planting areas but high yields. Water spinach also belongs to this category. Therefore, to meet the requirements of the problem, crops with small planting areas but high yields, such as cucumbers and water spinach, can be given priority for planting. Figure 6. The yield per mu and planting area of different types of crops Based on the above analysis, it can be concluded that cucumbers are an advantageous crop with small planting area, high yield, and high profit. When designing the plan, cucumbers can be given priority for planting. However, cucumbers can only be grown in irrigated land and greenhouses, which are limited by the type of arable land, so further analysis and consideration are needed. Similarly, the priority ranking for planting all crops can be derived. 57 4. Model Establishment and Solution 4.1. Symbol Explanation Table 1. Symbol Explanation SYMBOL EXPLANATION UNIT The yield per mu of Class i crops on Type j land Jin The planting cost of Class i crops on Type j land. Yuan The average selling price per unit of Class i crops on Type j land Yuan/Jin The profit of Class i crops on Type j land in the k-th year. Yuan The planting area of Class i crops on Type j land in the k-th year Mu Floating parameter / The maximum planting area corresponding to Plot j Mu 4.2. Using Monte Carlo to Solve Constrained Nonlinear Programming Problems (1) Optimizing the objective function based on nonlinear models Due to the influence of various factors such as season and market on the expected sales volume, yield per mu, cost price, and sales unit price of crops, it is impossible to know exactly the fluctuation of the relevant factors of crops, making it very difficult to make the best crop planting plan. To solve this problem, this paper establishes a nonlinear programming model with only one optimization objective: to maximize the profit of the current season's crops. However, this paper needs to discuss many influencing factors, and the constraints are relatively complex, with the specific situations as follows: 1) Expected sales volume changes Based on the problem, the average annual growth rate of wheat and corn is between 5% and 10%, while the expected sales volume of other crops is approximately ±5%. According to this, the objective function is established as follows: ∑ ∑ ∑ ∗ ∗ ∗ ∗ (1) is a fluctuation parameter, with values ranging from 5% to 10% for corn and wheat, and from -5% to 5% for other crops. 2) Changes in yield per mu Climate and other factors can affect the yield per mu of crops, with annual fluctuations of ±10%. However, greenhouses have an insulating effect and are not affected by climate. Based on this condition, the equation is established as follows: ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ (2) takes values from -10% to 10% (except for the two types of greenhouses). 3) Cost changes Due to the influence of the market, the planting cost of crops grows by about 5% each year. From this, we can derive the following equation: ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ (3) takes values of an annual increase of 5% (i.e., 5%, 10%, 15%, ...). 4) Sales price changes The sales price of grain crops basically remains stable. The sales price of vegetables grows by an average of about 5% each year. The price of edible fungi decreases by about 1%- 5% annually. Based on this, the following equations are established: ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ (4) is constant for grain crops; 5% for vegetables; -1% to - 5% for edible fungi (except morels); -5% for morels. (2) Determine the model function Based on the above conditions, the objective function is established as follows: ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ ∑ ∑ ∑ ∗ ∗ ∗ ∗ ∗ ∑ , ∈ 1,2, … ,41 , ∈ 1,2, … ,82 ∗ ∑ 0 All leguminous cropsi,x ∈ 1,2,3,4,5 . 0 , ∈ 1,2, … ,15 , ∈ 1,2, … ,26 , ∈ 0,1, … ,7 0 , 16, ∈ 27,28, … ,34 , ∈ 0,1, … ,7 0 , ∈ 17,18,… ,34 , ∈ 27,28,… ,54 ∪ 79,80,81,82 , ∈ 0,1, … ,7 0 , ∈ 35,36,37 , ∈ 55,56,… ,62 , ∈ 0,1, … ,7 0 , ∈ 38,39,40,41 , ∈ 63,64,… ,78 , ∈ 0,1, … ,7 0 , ∗ , ∈ 1,2, … ,34 , ∈ 0,1, … ,7 (5) 4.3. Greedy Algorithm Based on Monte Carlo Simulation Figure 7. Greedy Algorithm flowchart 58 (1) Principle of Greedy Algorithm The greedy algorithm is an algorithm used to find the optimal solution by making locally optimal decisions at each step, hoping that these local optimal decisions will lead to a globally optimal solution [2]. Figure 7 is the flowchart of the greedy algorithm. (2) Greedy Algorithm based on Monte Carlo Simulation The key to Monte Carlo simulation is to estimate and optimize the uncertainty in complex systems through a large number of random samples, thereby finding the best decision- making strategy [3]. It is suitable for problems with uncertain factor changes, such as this paper. Figure 8. Monte Carlo simulation flowchart The simulation flowchart of the Greedy Algorithm based on Monte Carlo simulation is shown in Figure 8. Based on the problem data, first define the probability distributions for sales volume, yield per mu, planting cost, and sales price, and generate a large number of random samples from these distributions. Then, for each sample, calculate the total profit of the above objective function. Finally, evaluate the distribution of profits and select the planting plan that maximizes the expected profit and is acceptable in terms of risk. By programming in MATLAB based on function (5), the planting plan and maximum profit for 2024-2030 can be obtained. Figure 9. The 2024 crop planting plan for the village. Figure 9 shows the crop planting plan for the village in 2024. Due to space limitations, this paper only presents the crop planting situation for the year 2024. The total profit obtained for the years 2024-2030 is 8.2 million yuan (81,613,411.2134 yuan). 5. Model Evaluation and Promotion 5.1. Advantages of the Model (1) Nonlinear programming optimization is comprehensive, capable of handling complex optimization problems, and suitable for a variety of constraints and objective functions. It is well-suited to solving various nonlinear problems. (2) Monte Carlo simulation can be used to address complex problems with strong uncertainty, by estimating and optimizing the uncertainty in complex systems through a large number of random samples, thus finding the best decision-making strategy. It is applicable to problems with uncertain factor changes, such as those discussed in the article. 5.2. Disadvantages of the Model (1) The greedy strategy can only guarantee a local optimum and cannot ensure a global optimum. It is not suitable for all problems, especially complex problems that require global optimization. References [1] Huang Chengjian, Li Xiang, Liu Xiaokang, Pan Tingjie, Lei Ning, Luo Fang, Zhao Siyi The impact of different crop cultivation on soil and heavy metals in crops [J/OL] Crop Magazine: 1-10. [2] Shi Gaojian, Wang Xinwei, Liu Qiang, Mu Li, He Jiayi Improved RRT~(*) algorithm for robotic arm path planning based on greedy strategy [J/OL] Manufacturing Technology and Machine Tools: 1-12. [3] Xu Changming, Zhou Qilei, Wang Yichuan, Wang Dongnian, Jin Zhanggen, Wang Junwei Monte Carlo graph search for maintaining global game graph [J] Journal of Chongqing University of Technology (Natural Sciences), 2024, 38 (05): 130-136.