Crop planting optimization method based on double-layer market fluctuation management

By constructing a Markov decision-making process model, combining short-term and long-term market information, dynamically optimizing crop planting decisions has been solved, and traditional planting plans are difficult to cope with market price fluctuations, achieving maximization of farmers' returns and robustness of planting plans.

CN119578646APending Publication Date: 2025-03-07NANTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411725269.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

Traditional agricultural planting plans are difficult to cope with complex changes in market prices, especially when market prices fluctuate violently, farmers are unable to adjust their planting decisions in time, resulting in unstable returns.

Method used

By constructing a crop planting optimization method based on Markov decision-making process model, and combining short-term market price fluctuations and long-term price trends, crop planting decisions are dynamically optimized. This method includes defining the state space and action space, building a state transfer matrix and reward function, using a value iteration algorithm to update the value function, and finally outputting the optimal planting strategy.

Benefits of technology

It has achieved that farmers quickly adjust their planting strategies when market prices fluctuate greatly, seize market opportunities, and obtain high returns. Through long-term trend forecasts, they ensure steady growth in returns, and improve the economic benefits of crop planting and the robustness of planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578646A_ABST
    Figure CN119578646A_ABST
Patent Text Reader

Abstract

The invention relates to a crop planting optimization method and device based on double-layer market fluctuation management, computer equipment and a storage medium. The method comprises the following steps: defining a crop planting state space according to a state space variable set and determining a state transition rate, and defining a crop planting action space according to an action space variable set; constructing a Markov decision process model based on a state space and an action space of crop planting; constructing a reward function based on the short-term market fluctuation and the long-term price trend, wherein the reward function is used for calculating the planting income in each state by adjusting the weights of the short-term market fluctuation and the long-term price trend; and constructing an iterative formula of the value function based on the state transition matrix and the reward function, iteratively updating the value function of each state by adopting a value iterative algorithm, and outputting a planting strategy with the maximum value function when the value function converges. The method can maximize the income of farmers, and is especially suitable for the environment with frequent market price fluctuation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of agricultural planting optimization, and in particular to a crop planting optimization method, device, computer equipment and storage medium based on double-layer market volatility management. Background Art

[0002] In the field of traditional agricultural planting, crop planting planning is often statically optimized based on historical data. However, due to the volatility of agricultural product market prices, traditional static planning is difficult to cope with complex market changes, especially when market prices fluctuate sharply, farmers are unable to adjust their planting decisions in time, resulting in unstable returns. In addition, traditional models rarely consider the combined effects of short-term fluctuations and long-term trends, and cannot provide forward-looking and immediate planting strategies. Summary of the invention

[0003] Based on this, it is necessary to provide a crop planting optimization method, device, computer equipment and computer-readable storage medium based on double-layer market fluctuation management, which can combine short-term market price fluctuations and long-term market trends and dynamically optimize crop planting decisions in response to the above-mentioned technical problems.

[0004] In a first aspect, the present application provides a crop planting optimization method based on double-layer market volatility management, comprising:

[0005] Step S1, defining a state space of crop planting according to a state space variable set and determining a state transition rate, and defining an action space of crop planting according to an action space variable set, wherein the state space variable set includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans;

[0006] Step S2, constructing a Markov decision process model based on the state space and action space of crop planting, wherein the Markov decision process model includes a state transfer matrix and a reward function;

[0007] Step S3, constructing a reward function based on short-term market fluctuations and long-term price trends, where the reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends;

[0008] Step S4, construct an iterative formula of the value function based on the state transfer matrix and the reward function, use the value iteration algorithm to iteratively update the value function of each state, and output the planting strategy with the maximum value function when the value function converges.

[0009] In one embodiment, step S4 further includes:

[0010] Obtain market volatility data, and dynamically adjust the weights of short-term market volatility and long-term price trends based on the market volatility data to generate a planting strategy corresponding to the market volatility data.

[0011] In one embodiment, defining the state space of crop planting and determining the state transition rate according to the state space variable set in step S1 includes:

[0012] Collect historical data of a state transition rate factor set, where the state transition rate factor set includes market price data, climate data, and crop growth data;

[0013] The prediction results of the state transition rate factor set are obtained by using the time series prediction model and regression analysis model;

[0014] A state transition matrix is ​​constructed based on the prediction results of the state transition rate factor set. The state transition matrix is ​​used to list the state transition rates that may be transferred to future states when executing the target action in different states;

[0015] The state transition rate is calculated based on the historical data and the predicted results of the state transition rate factor set.

[0016] In one embodiment, the prediction results of the state transition rate factor set obtained by using the time series prediction model and the regression analysis model include:

[0017] The short-term market fluctuations and climate changes concentrated in the state transition rate factors are dynamically predicted through the time series forecasting model, and the long-term market trends concentrated in the state transition rate factors are predicted through the regression analysis model.

[0018] In one embodiment, constructing a reward function based on short-term market fluctuations and long-term price trends in step S3 includes:

[0019] The reward function is constructed with short-term market fluctuations, long-term price trends, crop yields, planting costs, and dynamic adjustment coefficients as parameters, where the dynamic adjustment coefficient determines the weights of short-term market fluctuations and long-term price trends.

[0020] In one embodiment, the iterative formula for constructing the value function based on the state transfer matrix and the reward function in step S4 includes:

[0021] The value function of the target state is calculated using the reward function of the target state, the discount factor, the state transfer rate from the target state to the future state, and the value function of the future state, where the discount factor represents the discount coefficient of future benefits.

[0022] In one embodiment, in step S4, the value function of each state is iteratively updated using a value iteration algorithm, and when the value function converges, the planting strategy with the maximum value function output includes:

[0023] At the initial stage of the iteration, the values ​​of all crop states are set to zero;

[0024] In the first iteration, the value function of different crops in each state is calculated based on the state transition rate and reward function;

[0025] In the second iteration, the value functions of different crops in each state are updated according to the value function of the first iteration and the iterative formula of the value function;

[0026] Repeat the iteration of the value function of different crops in each state until the value function converges;

[0027] Compare the value functions of different crops when they converge, and output the planting strategy corresponding to the crop with the largest value function.

[0028] In a second aspect, the present application also provides a crop planting optimization device based on double-layer market volatility management, comprising:

[0029] A state space and action space definition module, used for defining a state space of crop planting according to a state space variable set and determining a state transition rate, and defining an action space of crop planting according to an action space variable set, wherein the state space variable set includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans;

[0030] A Markov decision process model building module is used to build a Markov decision process model based on the state space and action space of crop planting. The Markov decision process model includes a state transfer matrix and a reward function.

[0031] A reward function building module, which is used to build a reward function based on short-term market fluctuations and long-term price trends. The reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends;

[0032] The value function iteration module is used to construct an iterative formula of the value function based on the state transfer matrix and the reward function, and adopts the value iteration algorithm to iteratively update the value function of each state. When the value function converges, the planting strategy with the maximum value function is output.

[0033] In a third aspect, the present application also provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a crop planting optimization method based on two-tier market volatility management when executing the computer program.

[0034] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a crop planting optimization method based on two-tier market volatility management.

[0035] The above-mentioned crop planting optimization method, device, computer equipment and computer-readable storage medium based on double-layer market volatility management define the state space of crop planting and determine the state transition rate according to the state space variable set, and define the action space of crop planting according to the action space variable set, wherein the state space variable set includes the crop planting area, climatic conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and tillage plans; by real-time prediction of market price fluctuations, farmers can quickly adjust their planting strategies in the case of large price fluctuations, seize market opportunities, obtain high returns, and maximize short-term returns; combined with the prediction of long-term price trends, the model helps farmers formulate long-term plans to ensure steady growth of returns in a stable market environment and achieve long-term stable returns. A Markov decision process model is constructed based on the state space and action space of crop planting, and the Markov decision process model includes a state transfer matrix and a reward function; a reward function is constructed based on short-term market fluctuations and long-term price trends, and the reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends; an iterative formula of the value function is constructed based on the state transfer matrix and the reward function, and the value function of each state is iteratively updated using a value iteration algorithm. When the value function converges, the planting strategy with the maximum value function is output, and farmers can flexibly adjust planting decisions according to real-time market price fluctuations and long-term trends, thereby significantly improving the economic benefits of crop planting. By combining short-term and long-term market information, the model effectively reduces the impact of single market fluctuations on farmers' decisions, improves the robustness of planting planning, and reduces market risks. This application is particularly suitable for crop planting environments with large market price fluctuations, and can help farmers cope with market price uncertainties and optimize planting income. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of a process flow of a crop planting optimization method based on double-layer market volatility management in one embodiment;

[0037] Figure 2 A schematic diagram of a flow chart of a step of determining a state transition rate in one embodiment;

[0038] FIG3( a ) is a schematic diagram of short-term wheat price prediction in one embodiment;

[0039] FIG3( b ) is a schematic diagram of short-term corn price prediction in one embodiment;

[0040] FIG3( c ) is a schematic diagram of short-term soybean price prediction in one embodiment;

[0041] FIG3( d ) is a schematic diagram of rewards for different crops in one embodiment;

[0042] Figure 4 A schematic diagram of a process of iteratively updating the value function of each state using a value iteration algorithm in one embodiment;

[0043] Figure 5 It is a flowchart of a crop planting optimization method based on double-layer market volatility management in yet another embodiment. DETAILED DESCRIPTION

[0044] Due to the volatility of agricultural product market prices, traditional static planning is difficult to cope with the complex changes in the market, especially when market prices fluctuate violently, farmers are unable to adjust their planting decisions in time, resulting in unstable income. In addition, traditional models rarely consider the combined effects of short-term fluctuations and long-term trends, and cannot provide forward-looking and immediate planting strategies. Therefore, there is an urgent need for a crop planting optimization method that can combine short-term market fluctuations with long-term trends to improve the flexibility of crop planting and maximize profits. The present application provides a crop planting optimization method based on two-layer market volatility management, which aims to solve the problem of insufficient response of crop planting planning to market fluctuations in the prior art. The present application combines short-term market fluctuations with long-term market trends to construct a Markov decision process model, dynamically optimize crop planting decisions, and improve farmers' economic benefits.

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] In an exemplary embodiment, Figure 1 As shown, a crop planting optimization method based on double-layer market volatility management is provided, including:

[0047] Step S1, defining the state space of crop planting according to the state space variable set and determining the state transition rate, defining the action space of crop planting according to the action space variable set, wherein the state space variable set includes the crop planting area, climatic conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans.

[0048] Specifically, the state space and action space of crop planting are defined. The state space includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends; the action space includes adjusting the planting area and changing the crop type for each plot of land.

[0049] Exemplarily, the state space definition includes a number of key variables, including:

[0050] Crop planting areaA crop , indicating the actual planting area of ​​the current farmland; short-term market price fluctuations P short , use time series prediction models (such as LSTM, ARIMA) to predict short-term market prices and reflect market dynamics in real time; time series prediction models include LSTM (Long Short-Term Memory) and ARIMA (Autoregressive Integrated Moving Average model); long-term market price trends P long , predict future market price trends based on historical price data, climate change, policy impact and market demand; climate conditions C cli , including soil moisture, temperature, precipitation and other environmental factors, which affect crop growth and yield; market demand D market , reflecting the changes in current market demand for specific crops; these state variables are used to describe the market and crop planting conditions in each decision cycle and constitute the state space in the model.

[0051] Exemplarily, an action space is constructed, which defines the decisions that farmers can perform in each planting cycle, including: the selection of crop types, farmers can choose different crops to plant according to market demand and price changes; the adjustment of planting area, dynamically adjusting the planting area of ​​each crop according to market fluctuations to ensure maximum profit; the formulation of crop rotation and tillage plans, dynamically planning crop rotation strategies according to market prices and climatic conditions to ensure the sustainable use of land resources.

[0052] Step S2, constructing a Markov decision process model based on the state space and action space of crop planting, wherein the Markov decision process model includes a state transfer matrix and a reward function.

[0053] Specifically, a Markov Decision Process (MDP) model is constructed, in which short-term market price fluctuations are updated through real-time data and time series prediction models, and long-term market trends are determined based on historical data and trend prediction models.

[0054] Exemplarily, a Markov decision process model is constructed. The core of the Markov decision model is to make the optimal planting decision in each cycle through the state transition matrix and the reward function. The state transition of the model in this application depends on short-term market price fluctuations and long-term market price trends. Short-term market fluctuations dynamically predict market price fluctuations through time series prediction models (such as LSTM or ARIMA). According to the predicted short-term price fluctuations, the model updates the state in real time and adjusts the planting strategy. The long-term market trend is based on historical market data and trend prediction models to analyze the long-term change trend of future prices and provide forward-looking market price expectations. At each time step, the Markov decision process model calculates the transition probability of the future state based on the current state and action, that is, the state transition rate, and optimizes the path of state transition through historical data and prediction models.

[0055] Step S3, constructing a reward function based on short-term market fluctuations and long-term price trends, and the reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends.

[0056] Specifically, a reward function is constructed to calculate the crop planting income by combining the weights of short-term market price fluctuations and long-term price trends. The definition is shown in formula (1):

[0057] r(s,a)=(α·P short +(1-α)·P long )·YC (1)

[0058] Among them, P short is the short-term α market price fluctuation, P long is the long-term market price trend, Y is the crop yield, and C is the planting cost. α is a dynamically adjusted weight factor, i.e., a dynamic adjustment coefficient, which determines the weight of short-term fluctuations and long-term trends and is used to adjust the impact ratio of short-term market fluctuations and long-term trends. When the market fluctuates violently, the α value increases to strengthen the impact of short-term fluctuations; when the market is stable, the α value decreases, relying more on long-term trends.

[0059] Step S4, construct an iterative formula of the value function based on the state transfer matrix and the reward function, use the value iteration algorithm to iteratively update the value function of each state, and output the planting strategy with the maximum value function when the value function converges.

[0060] Specifically, the value iteration algorithm is used to solve the Markov decision model to obtain the optimal planting strategy. The Markov decision model is the Markov decision process model.

[0061] In an exemplary embodiment, step S4 further includes obtaining market fluctuation data, and dynamically adjusting the weights of short-term market fluctuations and long-term price trends according to the market fluctuation data, so as to generate a planting strategy corresponding to the market fluctuation data.

[0062] Specifically, planting strategies are dynamically adjusted to adapt to market price fluctuations, and the weights of short-term and long-term prices are adjusted according to the degree of market volatility.

[0063] For example, the Markov decision model dynamically adjusts the planting strategy according to the real-time changes in market fluctuations. When the short-term market price fluctuates greatly, the α value increases, and the model pays more attention to the immediate benefits brought by short-term fluctuations. For example, when the market price rises suddenly, the model will give priority to planting high-yield crops and expand the planting area. When the market price is relatively stable, the α value decreases, and the model pays more attention to long-term trends, making the decision more forward-looking and ensuring the stable growth of long-term benefits. Through this dynamic adjustment mechanism, farmers can optimize their crop planting strategies according to market conditions in each planting cycle, maximize benefits and effectively avoid the risks brought by market price fluctuations.

[0064] In an exemplary embodiment, defining the state space of crop planting according to the state space variable set and determining the state transition rate in step S1 includes:

[0065] Collect historical data of a state transition rate factor set, where the state transition rate factor set includes market price data, climate data, and crop growth data;

[0066] The prediction results of the state transition rate factor set are obtained by using the time series prediction model and regression analysis model;

[0067] A state transition matrix is ​​constructed based on the prediction results of the state transition rate factor set. The state transition matrix is ​​used to list the state transition rates that may be transferred to future states when executing the target action in different states;

[0068] The state transition rate is calculated based on the historical data and the predicted results of the state transition rate factor set.

[0069] Specifically, the state transition matrix is ​​used to list the probability of transitioning to a target new state when executing a target action in different states, where the target new state is the future state.

[0070] For example, the state transition rate is dynamically adjusted according to the short-term market price forecast results, so that the decision of each planting cycle can respond to the fluctuation of market prices in a timely manner. Figure 2 As shown, in order to determine the state transition rate, the following steps can be used:

[0071] Step S101, collect historical data of the state transition rate factor set; first, it is necessary to collect historical data related to market prices, climate conditions, crop yields, etc., which can be used to estimate the transition probability under different states and actions; market price data includes daily, weekly or monthly crop price fluctuations; climate data includes temperature, precipitation, sunshine and other climate conditions; crop growth data records the growth status and yield changes of crops in different growth periods.

[0072] Step S102, using a time series prediction model; in order to predict future market prices and climate change, a time series model (such as LSTM, ARIMA) can be used to predict short-term price fluctuations and climate change, and the prediction results will directly affect the probability of state transition. Among them, short-term price fluctuation prediction uses historical price data to train a time series model to predict price changes in the next week or month; long-term trend prediction predicts future market price changes based on historical trends, determines the direction of long-term price changes, and can use a regression analysis model for prediction.

[0073] Step S103, constructing a state transfer matrix: After predicting market prices and climate change, a state transfer matrix can be constructed. The state transfer matrix lists the probabilities of each new state to which the model may transfer when performing a specific action in different states. For example, assuming that the current state is as shown in formula (2):

[0074] s=(A wheat ,A corn ,A soy ,P short,wheat ,P short,corn ,P short,soy ) (2)

[0075] That is, the planting area of ​​wheat, corn, and soybeans and short-term price fluctuations, among which A wheat is the wheat planting area, P short,wheat is the short-term market price fluctuation of wheat; corn is the area of ​​corn cultivation, P short,corn is the short-term market price fluctuation of corn; soy is the soybean planting area, P short,soy Short-term market price fluctuations for soybeans.

[0076] If the action a performed is to increase the wheat planting area, and assuming that the market price predicts that the wheat price will continue to rise, the future state s' is likely to be a further increase in the wheat planting area, and the probability of state transition is relatively high; if the weather forecast shows that there is a risk of excessive rainfall in the next week, which may affect crop growth, then crop growth in the future state s may be affected, yields will be reduced, and the probability of state transition is relatively low.

[0077] Step S104, calculate the state transition rate based on historical data and prediction results; the calculation of the state transition rate can be based on the statistical results of historical data and the output of the prediction model. Exemplarily, price fluctuations are predicted by a time series model in the future, and the prediction results are mapped into transition probabilities between different states; for example, if the probability of wheat price increase in the next week is 60%, then after the action of increasing the wheat planting area is executed, the transition probability of the state s of increased wheat planting area can be set to 0.6. Climate change is to predict future climate conditions through meteorological data; for example, if there is a 50% probability of excessive rainfall in the next week, the state transition rate of crop growth being affected can be set to 0.5.

[0078] Step S105, dynamically adjust the state transition rate in combination with multiple factors; since factors such as market prices, climate, and crop growth are dynamically changing, the state transition rate should also be dynamically adjusted. For example, the market price forecast may be updated daily, while the climate forecast may be updated weekly or monthly. By combining multiple factors, the state transition rate can be adjusted more accurately.

[0079] In an exemplary embodiment, the prediction results of the state transition rate factor set obtained by using a time series prediction model and a regression analysis model include dynamically predicting short-term market fluctuations and climate changes in the state transition rate factor set through the time series prediction model, and predicting long-term market trends in the state transition rate factor set through the regression analysis model.

[0080] Specifically, short-term market fluctuations are predicted in real time through time series prediction models, and the current market dynamics are reflected by continuously updating the state space. Time series prediction models include LSTM and ARIMA. Long-term market trends are predicted and analyzed through historical market price data, climate change, policy impact and market demand, and multi-dimensional data is combined to achieve accurate prediction of long-term market prices.

[0081] In an exemplary embodiment, constructing a reward function based on short-term market fluctuations and long-term price trends in step S3 includes:

[0082] The reward function is constructed with short-term market fluctuations, long-term price trends, crop yields, planting costs, and dynamic adjustment coefficients as parameters, where the dynamic adjustment coefficient determines the weights of short-term market fluctuations and long-term price trends.

[0083] Specifically, the reward function is the core of planting optimization, which calculates the planting benefits in each state. The reward function combines short-term market fluctuations and long-term price trends and is defined as shown in formula (1):

[0084] r(s,a)=(α·P short +(1-α)·P long)·YC (1)

[0085] Among them, P short is the short-term α market price fluctuation, P long is the long-term market price trend, Y is the crop yield, and C is the planting cost. α is a dynamically adjusted weight factor, that is, a dynamic adjustment coefficient, which determines the weight of short-term fluctuations and long-term trends, and is used to adjust the impact ratio of short-term market fluctuations and long-term trends. When the market fluctuates violently, the α value increases to strengthen the impact of short-term fluctuations; when the market is stable, the α value decreases and relies more on long-term trends. The design of this reward function ensures that the planting income can take into account both the short-term fluctuations and long-term trends of the market, so that planting decisions can adapt to instantaneous changes in the market and be optimized according to long-term price expectations. By dynamically adjusting the α value, the reward function can respond flexibly to different market environments and maximize benefits.

[0086] Specifically, in order to calculate the benefit of each state, that is, the reward function, it is necessary to use the planting area, crop yield, market price and planting cost for estimation.

[0087] For example, the short-term wheat price forecast is shown in FIG3(a), the short-term corn price forecast is shown in FIG3(b), the short-term soybean price forecast is shown in FIG3(c), and the rewards for different crops are shown in FIG3(d).

[0088] The calculation of wheat reward function includes: α is 0.7, the long-term stable price of wheat is 5 yuan / kg, and the short-term price rises by 5% to 5.25 yuan / kg; assuming that the yield is 6000 kg / hectare and the planting cost is 2 yuan / kg; the wheat profit calculation is shown in formula (3):

[0089] r(s'1,a)=(0.7×5.25+0.3×5.00)×6000-2×6000=19050 yuan / hectare (3)

[0090] The calculation of the corn reward function includes: α is 0.7, the corn price is stable, and it is 6 yuan / kg; assuming that the yield is 8000 kg / hectare and the planting cost is 6 yuan / kg; the corn profit calculation is shown in formula (4):

[0091] r(s'2,a)=(0.7×6.00+0.3×6.00)×8000-6×8000=0 yuan / hectare (4)

[0092] The calculation of the soybean reward function includes: α is 0.7, the long-term stable price of soybeans is 1 yuan / kg, and the short-term price drops by 2% to 0.98 yuan / kg; assuming that the yield is 3500 kg / hectare and the planting cost is 2.5 yuan / kg; the soybean profit calculation is shown in formula (5):

[0093] r(s'3,a)=(0.7×0.98+0.3×1.00)×3500-2.5×3500=-5299 yuan / hectare (5)

[0094] In an exemplary embodiment, the iterative formula for constructing the value function based on the state transition matrix and the reward function in step S4 includes:

[0095] The value function of the target state is calculated using the reward function of the target state, the discount factor, the state transfer rate from the target state to the future state, and the value function of the future state, where the discount factor represents the discount coefficient of future benefits.

[0096] Specifically, the value iteration algorithm is used to recursively calculate the value of each state, and finally obtain the optimal planting decision through optimization. In each decision cycle, the model iteratively updates the value function of the state through the following formula (6):

[0097]

[0098] Among them, V(s) represents the value function of state s, that is, the long-term benefit that can be obtained by executing the optimal action a in state s; r(s,a) is the immediate reward, that is, the benefit obtained after executing action a in the current state s, calculated by combining the dynamic changes of short-term and long-term market prices; γ is the discount factor, which represents the discount coefficient of future benefits. Usually, the value of γ is between 0 and 1, which is used to balance current benefits and future benefits; ∑ s' P(s'|s,a) represents the transition probability from state s to state s', which is determined by short-term market price fluctuations and long-term price trends. State s is the target state and state s' is the future state. By recursively calculating the value function, the model will automatically generate the optimal planting strategy. At each time step, the Markov decision process model selects action a that maximizes long-term benefits and applies it to the current planting strategy.

[0099] In an exemplary embodiment, in step S4, the value function of each state is iteratively updated using a value iteration algorithm, and when the value function converges, the planting strategy with the maximum value function output includes:

[0100] At the initial stage of the iteration, the values ​​of all crop states are set to zero;

[0101] In the first iteration, the value function of different crops in each state is calculated based on the state transition rate and reward function;

[0102] In the second iteration, the value functions of different crops in each state are updated according to the value function of the first iteration and the iterative formula of the value function;

[0103] Repeat the iteration of the value function of different crops in each state until the value function converges;

[0104] Compare the value functions of different crops when they converge, and output the planting strategy corresponding to the crop with the largest value function.

[0105] Specifically, the optimal planting strategy is obtained by recursively updating the value of each state until the value functions of all states converge.

[0106] For example, suppose a farmer needs to dynamically adjust the crop planting area according to market price fluctuations and climate conditions. Assume that the farmer's initial state is 50 hectares of wheat, 30 hectares of corn, and 20 hectares of soybeans, and the market price and climate conditions have been predicted. Figure 4 As shown, in this embodiment, the following steps will be used to demonstrate how to perform iterative calculation:

[0107] The initial data includes the current state s: A wheat =50 hectares, A corn =30 hectares, A soy = 20 hectares; Market price fluctuation forecast: Wheat price is expected to increase by 5%; Corn price is stable; Soybean price decreases by 2%; Climate conditions: The probability of excessive rainfall in the next week is 40%.

[0108] Step S401, initializing state value;

[0109] At the initial stage of iteration, it is assumed that the value of all states is 0, as shown in formula (7):

[0110]

[0111] Step S402, calculating the instant reward r(s,a);

[0112] In the current state, the farmer can choose to increase the wheat planting area (reduce the soybean planting area). Assuming that the farmer performs this action, the immediate reward for each state is calculated according to the previous reward function:

[0113] Immediate reward for wheat: r(s'1,a) = 19050 yuan / hectare;

[0114] Immediate reward for corn: r(s'2,a) = 0 yuan / hectare;

[0115] Immediate reward for soybeans: r(s'3,a) = -5299 yuan / hectare.

[0116] Step S403, calculating the state transition rate;

[0117] According to the market price and climate change forecast, the probability of state transition, that is, the state transition rate, is obtained:

[0118] P(s'1|s,a)=0.36(wheat price rises, climate is favorable);

[0119] P(s'2|s,a)=0.42(corn prices are stable and the climate is suitable);

[0120] P(s'3|s,a)=0.3(soybean prices fall and the climate is suitable).

[0121] Step S404, iteratively updating the value;

[0122] Through the value iteration formula, in the first iteration, the value of each state is updated according to the state transition probability and the immediate reward; assuming the discount factor γ = 0.9, the state value V(s'1) of wheat is updated, as shown in formula (8):

[0123] V(s'1)=r(s'1,a)+γ∑ s' P(s'|s,a)V(s') (8)

[0124] Since V(s') = 0 at the initial stage, the state value at the first iteration is as shown in formula (9):

[0125] V(s'1)=19050+0.9×(0.36×0)=19050 (9)

[0126] Update the state value V(s'2) of corn as shown in formula (10):

[0127] V(s'2)=r(s'2,a)+γ∑ s' P(s'|s,a)V(s') (10)

[0128] Since V(s') = 0, the state value at the first iteration is as shown in formula (11):

[0129] V(s'2)=0+0.9×(0.42×0)=0 (11)

[0130] Update the soybean state value V(s'3) as shown in formula (12):

[0131] V(s'3)=r(s'3,a)+γ∑ s' P(s'|s,a)V(s') (12)

[0132] Since V(s') = 0, the state value at the first iteration is as shown in formula (13):

[0133] V(s'3)=-5299+0.9×(0.3×0)=-5299 (13)

[0134] Step S405, continue iteration;

[0135] In the next iteration, the value of state s will no longer be 0, but will be based on the previous iteration result. Therefore, the iteration formula will update the value of each state in the second iteration.

[0136] The state value of wheat is updated, that is, the second iteration:

[0137] Assuming that the future value of wheat V(s'1) has been updated to 19050 after the first iteration, continue to use the value iteration formula as shown in formula (14):

[0138] V(s'1)=19050+0.9×(0.36×19050)=25222.2 (14)

[0139] Corn's state value update, the second iteration:

[0140] Since corn did not receive an immediate reward in the previous iteration, its future value is still 0, as shown in formula (15):

[0141] V(s'2)=0+0.9×(0.42×0)=0 (15)

[0142] The state value of soybeans is updated, that is, the second iteration:

[0143] The future value of soybeans continues to be negative, as shown in formula (16):

[0144] V(s'3)=-5299+0.9×(0.3×(-5299))=-6729.73 (16)

[0145] Step S406, iterating until convergence;

[0146] Through multiple iterations, the model will continuously update the value of each state until the value of each state no longer changes significantly, that is, convergence. After enough iterations, the model will derive the final value of each state. At this point, farmers can make optimal planting decisions based on these values.

[0147] Specifically, a smaller threshold of 0.1 is set to determine whether convergence has occurred. The optimal decision options include: After multiple updates through value iteration, the final state value of the model is as follows:

[0148] Final state value of wheat: V(s'1) = 34284.4 yuan / hectare

[0149] The final value of corn: V(s'2) = 0 yuan / hectare

[0150] Final value of soybean: V(s'3) = -7817.95 yuan / hectare

[0151] Therefore, the optimal decision is to increase the area of ​​wheat, because wheat has the highest state value and is expected to bring the highest long-term benefits to farmers. On the contrary, since the state value of soybeans is negative, farmers should reduce the area of ​​soybeans.

[0152] In this embodiment, the process of value iteration is to continuously update the value of each state by repeatedly calculating the immediate reward and future income. Through multiple iterations, the model gradually converges to the final value of each state and finally obtains the optimal planting strategy. In this embodiment, through specific data calculations, the model selects the optimal decision of increasing the wheat planting area because this strategy can maximize the farmer's income under the current market price fluctuations and climate conditions.

[0153] In yet another embodiment, Figure 5 As shown, a crop planting optimization method based on double-layer market volatility management is provided, comprising:

[0154] Step 1: Define the state space and action space of crops; the state space includes crop planting area, climate conditions, market demand, short-term market price fluctuations and long-term market price trends; the action space includes adjusting the planting area and changing the crop type for each plot of land.

[0155] Step 2: Construct a Markov decision process model; construct a Markov decision process model through short-term market price fluctuation prediction and long-term market trend analysis.

[0156] Step three: Construct a reward function. Combine short-term market fluctuations with long-term trends to design a reward function and calculate planting returns in real time.

[0157] Step 4: Solve the optimal planting strategy through the value iteration algorithm; obtain the optimal planting strategy by recursively calculating the value of each state.

[0158] Step five: Dynamically adjust planting plans to adapt to market and environmental changes; based on market price fluctuations, dynamically adjust the weights of short-term fluctuations and long-term trends in decision-making to achieve flexible planting planning.

[0159] In an exemplary embodiment, it is assumed that a farmer grows three crops, wheat, corn and soybeans, and faces a market environment with significant short-term price fluctuations and long-term price trend changes. The farmer hopes to maximize his profits in a market environment with large price fluctuations by optimizing the planting strategy. The first is the short-term market fluctuation prediction, that is, the short-term price fluctuations of wheat, corn and soybeans in the next week are predicted by the ARIMA model. The results show that the price of wheat has a significant upward trend in the short term, while the price fluctuations of corn and soybeans are small. At the same time, the long-term price trend analysis, that is, based on the historical data of the past five years, the long-term price trend is predicted using a regression analysis model. The results show that the price of corn will show an upward trend in the next six months, while the prices of wheat and soybeans tend to be stable. Then adjust the planting strategy, that is, according to the short-term and long-term price forecasts, the model calculates the optimal planting strategy in the current market environment. Due to the short-term increase in wheat prices, the model recommends that farmers increase the planting area of ​​wheat to obtain immediate benefits; while the long-term trend shows that the price of corn may rise in the future, and the model recommends that farmers increase the planting area of ​​corn when planning the next season. At the same time, the strategy is adjusted dynamically, that is, the model will dynamically adjust the planting decision according to the weekly market price fluctuations. For example, if the market price next week shows that soybean prices have an upward trend, the model will adjust the planting area and recommend that farmers reduce the wheat planting area and increase the planting proportion of soybeans. Through this dynamic optimization method, farmers can flexibly respond to price changes in a complex market environment and achieve continuous maximization of profits.

[0160] The optimization method provided in this application dynamically optimizes crop planting decisions by combining short-term market price fluctuations and long-term market trends. This method uses a Markov decision process model (MDP) and predicts short-term market price fluctuations through a time series prediction model (such as LSTM or ARIMA), combines historical data to analyze long-term price trends, and constructs an optimization strategy that considers market fluctuations at different time scales. By dynamically adjusting the planting area and crop type, this method can maximize farmers' income, which is particularly suitable for environments where market prices fluctuate frequently.

[0161] At least a portion of the steps in the flowcharts involved in the embodiments described above may include multiple steps or multiple stages. These steps or stages may be executed at different times, or may be executed in turn or alternation with other steps or at least a portion of the steps or stages in other steps.

[0162] Based on the same inventive concept, the embodiment of the present application also provides a crop planting optimization device based on double-layer market volatility management for implementing the crop planting optimization method based on double-layer market volatility management involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the crop planting optimization device based on double-layer market volatility management provided below can refer to the limitations of the crop planting optimization method based on double-layer market volatility management above, and will not be repeated here.

[0163] In an exemplary embodiment, a crop planting optimization device based on double-layer market volatility management is provided, comprising:

[0164] A state space and action space definition module, used for defining a state space of crop planting according to a state space variable set and determining a state transition rate, and defining an action space of crop planting according to an action space variable set, wherein the state space variable set includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans;

[0165] A Markov decision process model building module is used to build a Markov decision process model based on the state space and action space of crop planting. The Markov decision process model includes a state transfer matrix and a reward function.

[0166] A reward function building module, which is used to build a reward function based on short-term market fluctuations and long-term price trends. The reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends;

[0167] The value function iteration module is used to construct an iterative formula of the value function based on the state transfer matrix and the reward function, and adopts the value iteration algorithm to iteratively update the value function of each state. When the value function converges, the planting strategy with the maximum value function is output.

[0168] Each module in the crop planting optimization device based on double-layer market volatility management can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0169] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0170] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0171] For those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these modifications and improvements are all within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.

Claims

1. A crop planting optimization method based on double-layer market volatility management, characterized in that: The method comprises: Step S1, defining a state space of crop planting according to a state space variable set and determining a state transition rate, and defining an action space of crop planting according to an action space variable set, wherein the state space variable set includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans; Step S2, constructing a Markov decision process model based on the state space and action space of crop planting, wherein the Markov decision process model includes a state transfer matrix and a reward function; Step S3, constructing a reward function based on short-term market fluctuations and long-term price trends, where the reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends; Step S4, construct an iterative formula of the value function based on the state transfer matrix and the reward function, use the value iteration algorithm to iteratively update the value function of each state, and output the planting strategy with the maximum value function when the value function converges.

2. The method according to claim 1, characterized in that: After step S4, the following steps are also included: Obtain market volatility data, and dynamically adjust the weights of short-term market volatility and long-term price trends based on the market volatility data to generate a planting strategy corresponding to the market volatility data.

3. The method according to claim 1, characterized in that Defining the state space of crop planting and determining the state transition rate according to the state space variable set in step S1 includes: Collect historical data of a state transition rate factor set, where the state transition rate factor set includes market price data, climate data, and crop growth data; The prediction results of the state transition rate factor set are obtained by using the time series prediction model and regression analysis model; A state transition matrix is ​​constructed based on the prediction results of the state transition rate factor set. The state transition matrix is ​​used to list the state transition rates that may be transferred to future states when executing the target action in different states; The state transition rate is calculated based on the historical data and the predicted results of the state transition rate factor set.

4. The method according to claim 3, characterized in that The prediction results of the state transition rate factor set obtained by using the time series prediction model and the regression analysis model include: The short-term market fluctuations and climate changes concentrated in the state transition rate factors are dynamically predicted through the time series forecasting model, and the long-term market trends concentrated in the state transition rate factors are predicted through the regression analysis model.

5. The method according to claim 4, characterized in that The step S3 constructs a reward function based on short-term market fluctuations and long-term price trends, including: The reward function is constructed with short-term market fluctuations, long-term price trends, crop yields, planting costs, and dynamic adjustment coefficients as parameters, where the dynamic adjustment coefficient determines the weights of short-term market fluctuations and long-term price trends.

6. The method according to claim 5, characterized in that The iterative formula for constructing the value function based on the state transfer matrix and the reward function in step S4 includes: The value function of the target state is calculated using the reward function of the target state, the discount factor, the state transfer rate from the target state to the future state, and the value function of the future state, where the discount factor represents the discount coefficient of future benefits.

7. The method according to claim 6, characterized in that In step S4, the value iteration algorithm is used to iteratively update the value function of each state. When the value function converges, the planting strategy with the maximum value function output includes: At the initial stage of the iteration, the values ​​of all crop states are set to zero; In the first iteration, the value function of different crops in each state is calculated based on the state transition rate and reward function; In the second iteration, the value functions of different crops in each state are updated according to the value function of the first iteration and the iterative formula of the value function; Repeat the iteration of the value function of different crops in each state until the value function converges; Compare the value functions of different crops when they converge, and output the planting strategy corresponding to the crop with the largest value function.

8. A crop planting optimization device based on double-layer market volatility management, characterized in that: The device comprises: A state space and action space definition module, used for defining a state space of crop planting according to a state space variable set and determining a state transition rate, and defining an action space of crop planting according to an action space variable set, wherein the state space variable set includes crop planting area, climate conditions, market demand, short-term market fluctuations and long-term price trends, and the action space variable set includes the selection of crop types, adjustment of planting area, and formulation of crop rotation and farming plans; A Markov decision process model building module is used to build a Markov decision process model based on the state space and action space of crop planting. The Markov decision process model includes a state transfer matrix and a reward function. A reward function building module, which is used to build a reward function based on short-term market fluctuations and long-term price trends. The reward function is used to calculate the planting income in each state by adjusting the weights of short-term market fluctuations and long-term price trends; The value function iteration module is used to construct an iterative formula of the value function based on the state transfer matrix and the reward function, and adopts the value iteration algorithm to iteratively update the value function of each state. When the value function converges, the planting strategy with the maximum value function is output.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.