Training Method and Device for Water and Fertilizer Decision Model of Greenhouse

Through the multi-agent water and fertilizer decision model, the graph structure fusion characteristics and reinforcement learning are used to optimize water and fertilizer decisions, the environmental adaptability problem of greenhouse water and fertilizer management is solved, and the utilization rate of water and fertilizer and decision accuracy are improved.

CN118586432BActive Publication Date: 2025-07-11INTELLIGENT EQUIPMENT RESEARCH CENTER BEIJING ACADEMY OF AGRICULTURE AND FORESTRY SCIENCES

Patent Information

Application Number
CN202410809357.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2025-07-11
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

The existing greenhouse water and fertilizer management methods lack environmental adaptability and are difficult to adapt to complex and dynamic greenhouse environments, resulting in unsatisfactory water and fertilizer management results.

Method used

The multi-agent water and fertilizer decision model is adopted, and by constructing the graph structure fusion characteristics and graph attention network layer, combined with multi-agent reinforcement learning, the water and fertilizer decision model is optimized to achieve coordinated decision-making between various regions.

Benefits of technology

It improves the utilization rate of greenhouse water and fertilizer, improves the accuracy and reliability of water and fertilizer decisions, adapts to complex and dynamic greenhouse environments, and reduces operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586432B_ABST
    Figure CN118586432B_ABST
Patent Text Reader

Abstract

The present invention provides a training method and device for a water and fertilizer decision-making model of a greenhouse. The method includes: obtaining decision-making data to be processed by multiple agents, where the multiple agents include each area of the greenhouse; using the multiple agents as nodes, constructing a first graph structure based on the decision-making data to be processed, determining a graph structure fusion feature based on a graph attention network layer in an initial water and fertilizer decision-making model, and determining a water and fertilizer decision for each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of the agents to obtain a final water and fertilizer decision-making model. The method provided by the present invention constructs a first graph structure based on the decision-making data to be processed, obtains a graph structure fusion feature based on the graph attention network, and improves the data processing ability. The model is optimized through multi-agent reinforcement learning to obtain a more coordinated water and fertilizer decision and improve the water and fertilizer utilization rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural planting, and particularly to a training method and device for a water and fertilizer decision-making model of a greenhouse. Background Art

[0002] Tomato planting in a greenhouse can provide high-quality and high-yield tomato products without being affected by seasons and climates. However, it also faces challenges such as water and fertilizer management and environmental control, and requires agricultural producers to make reasonable decisions to ensure the growth status of tomatoes, the utilization rate of water and fertilizer, as well as the operating costs and benefits of the greenhouse. Existing water and fertilizer management methods mainly include those based on manual experience, fixed irrigation schemes, or methods based on sensors and controllers.

[0003] However, the existing technologies lack strong environmental adaptability and are difficult to adapt to the complexity and dynamics of the greenhouse environment and crop growth, such as non-linearity, time-variation, uncertainty, etc., resulting in unsatisfactory water and fertilizer management effects. Summary of the Invention

[0004] The present invention provides a training method and device for a water and fertilizer decision-making model of a greenhouse to solve the defect in the prior art that the adaptability to the greenhouse environment is poor, resulting in unsatisfactory water and fertilizer management effects.

[0005] The present invention provides a training method for a water and fertilizer decision-making model of a greenhouse, including:

[0006] Obtaining the to-be-decided data of multiple agents, where the multiple agents at least include each area of the greenhouse;

[0007] Taking the multiple agents as nodes, constructing a first graph structure based on the to-be-decided data, determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determining the water and fertilizer decisions of each agent based on the graph structure fusion feature;

[0008] Optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision rewards of each agent to obtain the final water and fertilizer decision-making model; the decision rewards are determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent.

[0009] According to the training method for a water and fertilizer decision-making model of a greenhouse provided by the present invention, the graph attention network layer includes a self-attention sub-layer and a feed-forward sub-layer;

[0010] The determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model includes:

[0011] Based on the self-attention sublayer and the first graph structure, apply the multi-head self-attention mechanism to determine the attention weights of each attention head and the feature representations of each attention head, and based on the attention weights of each attention head and the feature representations of each attention head, obtain the initial graph structure features of the first graph structure;

[0012] Based on the feed-forward sublayer, perform a non-linear transformation on the initial graph structure features to determine the graph structure fusion features of the first graph structure.

[0013] According to a training method for a water and fertilizer decision-making model of a greenhouse provided by the present invention, the optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent to obtain the final water and fertilizer decision-making model includes:

[0014] Taking the multi-agent as a node, based on the water and fertilizer decisions, decision-making rewards of each agent, and the data to be decision-making of the multi-agent, construct a second graph structure;

[0015] Based on the graph attention mechanism and the second graph structure, determine the decision-making fusion features of the second graph structure;

[0016] Based on the decision-making fusion features, with the goal of maximizing the decision-making rewards of each agent, optimize the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model.

[0017] According to a training method for a water and fertilizer decision-making model of a greenhouse provided by the present invention, the optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent based on the decision-making fusion features to obtain the final water and fertilizer decision-making model includes:

[0018] Based on the decision-making fusion features, determine the coordinated optimization strategies of each agent;

[0019] Based on the coordinated optimization strategies of each agent and the meta-learning algorithm, with the goal of maximizing the decision-making rewards of each agent, optimize the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model.

[0020] According to a training method for a water and fertilizer decision-making model of a greenhouse provided by the present invention, the constructing the first graph structure with the multi-agent as a node based on the data to be decision-making includes:

[0021] Taking the multi-agent as a node, using the relationships between each agent as edges, and based on the data to be decision-making of the multi-agent at the previous moment, construct the first graph structure at the previous moment;

[0022] Update the first graph structure based on the dynamic graph neural network and the first graph structure at the previous moment, and obtain the first graph structure at the current moment based on the graph convolutional network and the updated first graph structure.

[0023] According to a training method of a water and fertilizer decision-making model for a greenhouse provided by the present invention, the obtaining of the to-be-decided data of multiple agents includes:

[0024] Obtain the multi-source decision-making data of the multiple agents;

[0025] Extract the source data features of each data source of the multi-source decision-making data, and perform feature fusion on the source data features of each data source of the multiple agents respectively based on the tensor fusion network to obtain the to-be-decided data of the multiple agents.

[0026] The present invention also provides a training device for a water and fertilizer decision-making model for a greenhouse, including:

[0027] An obtaining unit, which obtains the to-be-decided data of multiple agents, and the multiple agents at least include each area of the greenhouse;

[0028] A feature fusion unit, taking the multiple agents as nodes, constructs a first graph structure based on the to-be-decided data, determines the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determines the water and fertilizer decision of each agent based on the graph structure fusion feature.

[0029] A training unit, aiming to maximize the decision-making rewards of each agent, optimizes the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model; the decision-making rewards are determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent.

[0030] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the training method of the water and fertilizer decision-making model for a greenhouse as described in any one of the above.

[0031] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the training method of the water and fertilizer decision-making model for a greenhouse as described in any one of the above.

[0032] The present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the training method of the water and fertilizer decision-making model for a greenhouse as described in any one of the above.

[0033] The training method and device for the water and fertilizer decision-making model of the greenhouse provided by the present invention use multi-agent as nodes, construct a first graph structure based on the data to be decision-making, and extract and fuse the graph structure fusion features based on the graph attention network, so as to improve the processing ability of the data to be decision-making. Moreover, the initial water and fertilizer decision-making model is optimized through multi-agent reinforcement learning to obtain a more coordinated water and fertilizer decision-making among regions, thereby improving the water and fertilizer utilization rate of the greenhouse. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0035] Figure 1 It is a schematic flowchart of the training method for the water and fertilizer decision-making model of the greenhouse provided by the present invention;

[0036] Figure 2 It is a schematic structural diagram of the training device for the water and fertilizer decision-making model of the greenhouse provided by the present invention;

[0037] Figure 3 It is a schematic structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0038] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention with reference to the accompanying drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0039] In the description of the embodiments of the present invention, it should be understood that the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present invention, "a plurality" means two or more unless otherwise specifically defined.

[0040] Water and fertilizer management is a key link in tomato cultivation in greenhouses, which directly affects the growth, quality, yield and water and fertilizer utilization rate of tomatoes. The main contents of water and fertilizer management include irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc., which need to be dynamically adjusted and optimized according to the environmental conditions in the greenhouse, the growth requirements of crops and the supply situation of water and fertilizer.

[0041] The traditional water and fertilizer management methods mainly include the following: ① Methods based on artificial experience. This method mainly relies on the experience and intuition of growers. According to the growth stage and appearance of crops, as well as the soil moisture and color, it judges the water and fertilizer requirements of crops, and then determines the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. according to experience or rules. The advantage of this method is that it is simple and easy to implement, and does not require professional equipment and technology. However, the disadvantages are that it is inaccurate, unstable, unreliable, easily affected by the subjective factors of growers and environmental factors, difficult to ensure the optimization and balance of water and fertilizer, and also difficult to achieve the precision and intelligence of water and fertilizer. ② Methods based on fixed irrigation schemes. This method mainly relies on pre-formulated irrigation schemes. According to the types, varieties, growth stages, etc. of crops, it determines the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. The advantage of this method is that it is standardized and can realize the automation and quantification of water and fertilizer. However, the disadvantages are that it lacks flexibility and adaptability, is difficult to make real-time adjustments and optimizations according to the multi-modal data in the greenhouse and the dynamically changing environment and requirements, and is also difficult to consider the mutual relations and influences among various regions and crops in the greenhouse, resulting in the mismatch and imbalance of water and fertilizer, the decline of crop growth conditions and water and fertilizer utilization rate, and the increase of greenhouse operation costs. ③ Methods based on sensors and controllers. This method mainly relies on various sensors and controllers installed in the greenhouse (such as soil moisture sensors, soil conductivity sensors, temperature and humidity sensors, light sensors, flow meters, valves, pumps, etc.). By collecting and analyzing multi-modal data such as soil moisture, soil conductivity, temperature, humidity, light, flow, etc. in the greenhouse, it controls the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. according to preset thresholds or algorithms. The advantages are precision and intelligence, and it can realize the real-time monitoring and control of water and fertilizer. However, the disadvantages are that it is complex and expensive, requires a large amount of equipment and technology, is also easily affected by the failures and interferences of sensors and controllers, difficult to ensure the optimization and balance of water and fertilizer, difficult to make full use of the multi-modal data and dynamic graph structure in the greenhouse, and also difficult to achieve the coordination and cooperation among multiple intelligent agents.

[0042] However, due to the complexity, nonlinearity, time-variation, and uncertainty of the greenhouse environment and crop growth, traditional water and fertilizer management methods often struggle to adapt to this complexity and dynamics, resulting in waste of water and fertilizer, growth disorders of crops, increased operating costs of the greenhouse, and reduced efficiency. To address the above problems, the present invention provides a training method for a water and fertilizer decision-making model of a greenhouse to adapt to the complex greenhouse environment and achieve high-utilization water and fertilizer decision-making. Figure 1 is a schematic flowchart of the training method for the water and fertilizer decision-making model of the greenhouse provided by the present invention, as Figure 1 shown, the method includes:

[0043] Step 110, obtaining the data to be decision-making of multiple agents, where the multiple agents at least include each area of the greenhouse;

[0044] Here, the water and fertilizer decision-making for controlling each area can be regarded as an agent. The data to be decision-making includes the environmental data and crop growth data of each area; specifically, data on the spatial environment and substrate characteristics in the greenhouse can be collected regularly or in real time through various sensors, such as temperature sensors, humidity sensors, light sensors, substrate temperature sensors, substrate drainage ratio sensors, substrate EC sensors, substrate pH value sensors, etc., and the data is stored in the database in numerical form to obtain the data to be decision-making of each area. In addition, data on the growth status of plants in the greenhouse can be collected regularly or in real time through image devices, such as cameras, and the data is stored in the database in the form of images or videos to obtain the crop growth data of the crops in the area.

[0045] Step 120, taking the multiple agents as nodes, constructing a first graph structure based on the data to be decision-making, determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determining the water and fertilizer decision-making of each agent based on the graph structure fusion feature;

[0046] In addition, the initial water and fertilizer decision-making model here can be a general water and fertilizer decision-making model without parameter adjustment. Specifically, first, a first graph structure can be constructed through the data to be decision-making of each agent with the multiple agents as nodes. The first graph structure here can reflect the mutual relationship between each area and the crops in the area. Then, through the multi-layer graph attention network layer in the initial water and fertilizer decision-making model, feature extraction and feature fusion are performed on the first graph structure to obtain the graph structure fusion feature, that is, the node features and edge features of each node, so as to achieve the information fusion of full aggregation of local information. Finally, the graph attention network can be used as an approximator of the value function or policy function to obtain the water and fertilizer decision-making of each agent, that is, the water and fertilizer decision-making of each agent is obtained.

[0047] Step 130: Optimize the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent to obtain the final water and fertilizer decision-making model; the decision-making rewards are determined based on the graph structure fusion features and the water and fertilizer decisions of each agent.

[0048] Specifically, the graph structure fusion features can be defined as the state space, which includes the growth state of the crop, the water and fertilizer utilization efficiency, and other plant and environmental factors (such as substrate temperature, drainage ratio, etc.). The water and fertilizer decisions are defined as the action space, which includes irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. Thus, based on the graph structure fusion features and the water and fertilizer decisions, the decision-making rewards of multiple agents can be obtained. The decision-making rewards here can be expressed by the following formula:

[0049]

[0050] In the formula, represents the decision-making reward of the i-th node at time t; represents the crop growth condition of the i-th node at time t, represents the water and fertilizer utilization rate of the i-th node at time t, and α and β represent the weight coefficients of the two.

[0051] Thus, based on the goal of maximizing the decision-making rewards, that is where T represents the termination time of the decision-making, γ represents the discount factor of the reward, to optimize the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model, realize the coordinated decision-making among multiple agents, i.e., multiple regions, and improve the performance of the water and fertilizer decision-making model in making water and fertilizer decisions.

[0052] The method provided in the embodiments of the present invention, with multiple agents as nodes, constructs a first graph structure based on the data to be decision-making, extracts and fuses the graph structure fusion features based on the graph attention network, and improves the processing ability of the data to be decision-making. Moreover, the initial water and fertilizer decision-making model is optimized through multi-agent reinforcement learning to obtain more coordinated water and fertilizer decisions among regions, and improve the water and fertilizer utilization rate of the greenhouse.

[0053] Based on any of the above embodiments, the graph attention network layer includes a self-attention sub-layer and a feed-forward sub-layer;

[0054] Determining the graph structure fusion features of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model includes:

[0055] Based on the self-attention sublayer and the first graph structure, apply the multi-head self-attention mechanism to determine the attention weights of each attention head and the feature representations of each attention head, and based on the attention weights of each attention head and the feature representations of each attention head, obtain the initial graph structure features of the first graph structure;

[0056] Based on the feed-forward sublayer, perform a non-linear transformation on the initial graph structure features to determine the graph structure fusion features of the first graph structure.

[0057] Specifically, each layer of the graph attention network layer can be divided into a self-attention sublayer and a feed-forward sublayer. The first graph structure can be input into the self-attention sublayer, and the first graph structure can be subjected to feature extraction and fusion through multiple layers of the graph attention network layer. For example, it can be expressed by the following formula:

[0058]

[0059] In the formula, Hi l represents the feature vector of the i-th node output by the self-attention sublayer of the l-th layer. It can be understood that the output of the last self-attention sublayer is the graph structure fusion feature; N represents the total number of nodes in the first graph structure; represents the attention weight of the i-th node in the l-th layer to the j-th node; represents the feature vector of the j-th node in the (l - 1)-th layer.

[0060] In detail, for each layer of the graph attention network layer, the scaled dot-product attention algorithm can be applied by each attention head in the self-attention sublayer to calculate the attention weight of each node to other nodes, obtain the feature representations and attention weights of each attention head, and realize the information exchange and fusion between nodes. The attention weight here can be calculated by the following formula:

[0061]

[0062] In the formula, represents the query vector of the i-th node in the l-th layer; represents the key vector of the j-th node in the l-th layer, represents the scaling factor, which is used to balance the distribution of attention weights.

[0063] Then, by concatenating the feature representations obtained by each attention head of each layer, the concatenated feature vector can be obtained, that is where, represents the feature vector of the i-th node output by the self-attention sublayer of the l-th layer; represents the H-th head feature vector of the i-th node in the l-th layer. Among them, K represents the dimension of the feature vector.

[0064] Then, based on the concatenated feature vectors and the attention weights, the initial graph structure features output by the self-attention sublayer are calculated. Further, the initial graph structure features are processed using the methods of residual connection and layer normalization, and the processing method can be shown as follows:

[0065]

[0066] In the formula, LN represents the layer normalization operation, which is used to maintain the stability of the mean and variance of the feature vectors. Then, the feed-forward sublayer can perform a non-linear transformation on the normalized feature vectors through a multi-layer perceptron to obtain the graph structure fusion features of the first graph structure, thereby realizing the feature update and enhancement of the nodes. For example, the graph structure fusion features of the first graph structure can be obtained through the following formula, as shown below:

[0067]

[0068] In the formula, MLP represents the multi-layer perceptron, σ represents the activation function, such as the ReLU function, represents the weight matrix and bias vector of the multi-layer perceptron, and F represents the dimension of the hidden layer. Thus, the feed-forward sublayer can process the initial graph structure features based on the residual connection and layer normalization to obtain the graph structure fusion features, enhancing the stability and convergence of the graph attention network. For example, it can be achieved through the following formula:

[0069]

[0070] The method provided by the embodiment of the present invention processes the first graph structure based on the graph attention network and the multi-head self-attention mechanism, realizes multi-angle and multi-scale information fusion, improves the performance and efficiency of the graph attention network, can effectively utilize the to-be-decided data in the greenhouse, enhances the expression ability and information volume of the data, and thus improves the accuracy and reliability of the optimal decision-making of greenhouse water and fertilizer. Compared with the traditional method, the method provided by the embodiment of the present invention can better handle the complex and non-linear relationships in the greenhouse, as well as the dynamic and uncertain environment, and has stronger generalization ability and adaptability.

[0071] Based on any of the above embodiments, optimizing the initial water and fertilizer decision model with the goal of maximizing the decision rewards of the agents to obtain the final water and fertilizer decision model includes:

[0072] Taking the multi-agent as a node, constructing a second graph structure based on the water and fertilizer decisions, decision rewards of the agents, and the to-be-decided data of the multi-agent;

[0073] Based on the graph attention mechanism and the second graph structure, determine the decision fusion features of the second graph structure;

[0074] Based on the decision fusion features, optimize the initial water and fertilizer decision model with the goal of maximizing the decision rewards of each agent to obtain the final water and fertilizer decision model.

[0075] Specifically, first, taking multi - agents as nodes, regarding the water and fertilizer decisions of each agent as actions, the decision rewards as rewards, and the data to be decided of multi - agents as states, construct a second graph structure. The second graph structure here can reflect the interactions between multi - agents. Then, based on the Markov decision process, represent the state, action, and reward of each agent as a vector, that is:

[0076]

[0077]

[0078] In the formula, represents the state vector of the i - th agent at time t; represents the feature vector of the data to be decided of the i - th node at time t, represents the feature vector of the first graph structure of the i - th node at time t; represents the edge feature vector of the i - th node at time t; M represents the dimension of the edge feature, and L = D + K + M represents the dimension of the state vector. represents the action vector of the i - th agent at time t; represents the irrigation time of the i - th node at time t, represents the irrigation amount of the i - th node at time t, represents the nutrient solution concentration of the i - th node at time t, represents the nutrient ratio of the i - th node at time t. represents the reward value of the i - th agent at time t.

[0079] Then, through the graph attention mechanism, calculate the influence of each agent on other agents in the second graph structure and the attention weights of each agent, so as to realize the information exchange and cooperation between multi - agents, that is, obtain the decision fusion features of the second graph structure. The decision fusion features here can be calculated by the following formula:

[0080]

[0081] In the formula, Ii t represents the influence vector of the i - th agent on other agents at time t; Denote the influence weight of the $i$-th agent on the $j$-th agent at time $t$; Denote the action vector of the $j$-th agent at time $t$; $W_i$ t Denote the attention weight of the $i$-th agent at time $t$; Denote the attention weight of the $i$-th agent on the $j$-th agent at time $t$; Denote the decision reward vector of the $j$-th agent at time $t$. Among them, and Can be calculated by the following formula:

[0082]

[0083] In the formula, Denote the query vector of the $i$-th agent at time $t$; Denote the key vector of the $j$-th agent at time $t$; Denote the value vector of the $j$-th agent at time $t$; and Denote the scaling factor, which is used to balance the distribution of influence weight and attention weight.

[0084] It should be noted that, based on the multi-head self-attention mechanism, the state vector, action vector, and reward value of each agent at time $t$ can be divided into $H$ heads, and the dimension of each head is $L / H$, $4 / H$, and $1 / H$. Then calculate the influence weight, attention weight, influence vector, and attention weight of each head respectively, and then concatenate the influence vectors and attention weights of the $H$ heads to obtain the influence vector and attention weight of each agent at time $t$, that is:

[0085]

[0086] In the formula, Denote the influence vector of the $h$-th head of the $i$-th agent at time $t$; Denote the attention weight of the $h$-th head of the $i$-th agent at time $t$; Concat represents the concatenation operation. Similarly, the output of the influence vector and attention weight can be processed by the method of residual connection and layer normalization, that is:

[0087]

[0088] In the formula, LN represents the layer normalization operation, which is used to maintain the stability of the mean and variance of the vector.

[0089] Additionally, a graph attention network can be used as an approximator for the value function or the policy function, that is, based on the decision fusion features, the coordinated water and fertilizer decisions of each optimized agent are obtained. Further, with the maximization of the decision rewards of multiple agents as the optimization objective, the initial water and fertilizer decision model can be optimized by the deep deterministic policy gradient method to obtain a water and fertilizer decision model for effective coordination and cooperation among multiple agents. For example, the deep deterministic policy gradient update can be achieved through the following formula, as shown below:

[0090]

[0091] In the formula, J(π) represents the performance function of the policy function; w a and w q represent the weight vectors or matrices of the policy function and the value function; represents the approximation of the value function of the i-th agent at time t; represents the approximation of the policy function of the i-th agent at time t; ρ μ represents the state distribution of the policy function; represents the experience replay buffer, represents the target value function of the i-th agent at time t; γ represents the discount factor of the reward.

[0092] Thus, the update and optimization of the value function and the policy function of each agent are realized, thereby realizing the output of the coordinated strategy of each agent, that is:

[0093]

[0094] In the formula, represents the water and fertilizer decision of the i-th agent at time t; represents the data to be decided of the i-th agent at time t; w a represents the weight vector of the policy function (water and fertilizer decision).

[0095] The method provided by the embodiments of the present invention constructs a second graph structure based on multi - agents as nodes, the water - fertilizer decisions, decision rewards of each agent, and the data to be decided of the multi - agents, and obtains decision - fusion features based on the graph attention mechanism and the second graph structure. With the goal of maximizing the decision rewards of each agent, the initial water - fertilizer decision model is optimized to obtain the final water - fertilizer decision model. That is, in the multi - agent reinforcement learning method based on the graph attention mechanism, the state, action, and reward of each agent are represented as a vector. The graph attention mechanism is used to calculate the influence of each agent on other agents and the attention weights of each agent, realizing effective coordination and cooperation among multi - agents. With the goal of maximizing decision rewards, the parameters of the initial water - fertilizer decision model are optimized to obtain a water - fertilizer decision model that finally realizes effective coordination and cooperation among multi - agents, thereby improving the water - fertilizer utilization rate of the greenhouse.

[0096] Based on any of the above embodiments, optimizing the initial water - fertilizer decision model with the goal of maximizing the decision rewards of each agent based on the decision - fusion features to obtain the final water - fertilizer decision model includes:

[0097] Determining the coordinated optimization strategies of each agent based on the decision - fusion features;

[0098] Optimizing the initial water - fertilizer decision model with the goal of maximizing the decision rewards of each agent based on the coordinated optimization strategies of each agent and the meta - learning algorithm to obtain the final water - fertilizer decision model.

[0099] Specifically, the graph attention network can be used as an approximator of the value function or policy function, that is, the coordinated optimization strategies of each agent are obtained based on the decision - fusion features and the graph attention network. Then, based on the coordinated optimization strategies of each agent and the meta - learning algorithm, with the goal of maximizing the decision rewards of each agent, the initial water - fertilizer decision model is optimized to obtain the final water - fertilizer decision model.

[0100] In one embodiment, the network parameters of the initial water - fertilizer decision model can be continuously updated through interaction and feedback with the environment simulated by the mechanism model to achieve the goal of maximizing the long - term cumulative reward, and techniques such as experience replay and target network are used to improve stability and convergence. In addition, when updating the network parameters based on the meta - learning method, the process of updating the network parameters can be regarded as a learning process, using meta - learning algorithm model - agnostic meta - learning, etc., to quickly adapt to new environments and tasks and improve the speed and effect of network parameter update. In one embodiment, the network parameters can be initialized as a meta - parameter by using the model - agnostic meta - learning method, that is:

[0101]

[0102] Wherein, w0 represents the initial value of the network parameters, and P represents the number of network parameters.

[0103] In addition, by using the gradient descent method to update the network parameters, a small amount of gradient updates are performed on each task, so as to achieve the generalization ability on different tasks. That is:

[0104]

[0105] Wherein, w i ′ represents the updated value of the network parameters on the i-th task; w0′ represents the updated value of the meta-parameters; η and ξ represent the learning rates; L i (w0) represents the loss function of the initial value of the network parameters on the i-th task; L i (wi′) represents the loss function of the updated value of the network parameters on the i-th task; represents the gradient operation on w0.

[0106] It should be noted that based on the meta-learning method, the rapid adaptation of the network parameters and the optimization of the meta-parameters are realized, thereby improving the speed and effect of the update of the network parameters of the initial water and fertilizer decision-making model.

[0107] During the training process of the initial water and fertilizer decision-making model, through the experience replay method, the state, action and reward of each agent can be stored in an experience pool, and a batch of data is randomly sampled from it for updating the network parameters, so as to break the temporal correlation of the data and improve the utilization rate of the data. That is:

[0108]

[0109] Among them, represents the experience replay buffer, represents the sampled data batch, B represents the size of the data batch, and Sample represents the sampling operation.

[0110] Moreover, through the target network method, the network parameters of the value function or policy function of each agent can be copied to a target network for calculating the target value function or target policy function, so as to reduce the oscillation of the network parameter update and improve the stability of the network parameter update. That is:

[0111] w v ′ = τw v +(1 - τ)w v ′

[0112] w a ′ = τw a +(1 - τ)w a ′

[0113] where, w v ′ and w a ′ represent the network parameters of the value function or policy function of the target network, τ represents the update rate of the target network, and 0 < τ < 1.

[0114] It should be noted that after the initial water and fertilizer decision-making model completes model training, the obtained water and fertilizer decision-making model can be evaluated and optimized. For example, based on different evaluation indicators, such as average reward, success rate, convergence speed, etc., the performance of the water and fertilizer decision-making model can be evaluated and compared. Using the method of multi-objective optimization, regarding the evaluation and optimization of the water and fertilizer decision-making model as a multi-objective problem, considering multiple evaluation indicators, and using multi-objective optimization algorithms, such as non-dominated sorting genetic algorithm, etc., to find the Pareto optimal solution of the model and improve the comprehensive performance and balance of the model.

[0115] Specifically, using the method of multi-objective optimization, regarding the evaluation and optimization of the model as a multi-objective problem, that is:

[0116] min f(x) = [f1(x), f2(x), …, f M (x)] T

[0117] In the formula, represents the solution of the model, represents the objective function vector of the model, f m (x) represents the m-th objective function of the model, M represents the number of objective functions, and P represents the number of network parameters.

[0118] Here, multiple evaluation indicators, that is, multi-objectives, can be expressed by the following formula:

[0119]

[0120] In the formula, f1(x) represents the negative value of the water and fertilizer utilization rate of the model; f2(x) represents the negative value of the yield of the model; f3(x) represents the cost of the model; N represents the number of nodes; T represents the termination time of the decision-making; represents the water and fertilizer utilization rate of the i-th node at time T; represents the crop growth status of the i-th node at time T; represents the cost of the i-th node at time T.

[0121] It should be noted that through interaction and feedback with the environment, using the method of meta-learning, it can quickly adapt to new environments and tasks, improve the speed and effect of network parameter update, and use techniques such as experience replay and target network to improve stability and convergence. Finally, using the method of multi-objective optimization, regarding the evaluation and optimization of the model as a multi-objective problem, considering multiple benefit evaluation indicators (such as water and fertilizer utilization rate, cost, yield, etc.), using non-dominated sorting genetic algorithm, etc., to find the Pareto optimal solution of the model, and improve the comprehensive performance and balance of the model. Thus, it can achieve efficient cooperation among multiple agents and a good balance among multiple objectives, thereby improving the efficiency and benefit of optimal decision-making of greenhouse water and fertilizer. Compared with traditional methods, the method provided by the embodiment of the present invention can better handle the problems of multiple agents and multiple objectives in the greenhouse, and has stronger cooperation ability and optimization ability.

[0122] It should also be noted that in the embodiment of the present invention, through the method of non-dominated sorting genetic algorithm, each solution of the water and fertilizer decision-making model is divided into different levels according to the principle of non-dominated sorting, using the method of crowding distance to calculate the crowding degree of each solution in the objective space, using the method of tournament selection to select excellent solutions according to the level and crowding distance, and using the method of crossover and mutation to generate new solutions, so as to find the Pareto optimal solution of the water and fertilizer decision-making model and improve the comprehensive performance and balance of the water and fertilizer decision-making model.

[0123] Specifically, the specific steps of the non-dominated sorting genetic algorithm are as follows: Initialize a population where each individual x represents a solution of a model, that is, the value of network parameters, calculate the objective function value f(x) of each individual, and divide the population into different levels according to the principle of non-dominated sorting where represents the first level, that is, the optimal level, represents the L-th level, that is, the worst level, satisfying the condition: where, represents x i dominates x j , that is: Calculate the crowding distance d(x) of each individual, that is, the crowding degree of each individual in the objective space, and its calculation method is:

[0124]

[0125] In the formula, xi+1 and xi-1 represent the two individuals adjacent to x on the m-th objective function, and Denote the maximum and minimum values in the population on the m-th objective function. If x is an individual on the boundary, i.e., it has no adjacent individuals, then set its crowding distance to infinity to ensure its selection probability.

[0126] Then, the tournament selection method can be used to select two individuals x and x a from the population. Compare their ranks and crowding distances, and select an individual as the parent according to the following rules: If x b and x a belong to different ranks, i.e., b and k≠l, then select the individual with the higher rank, i.e., if k < l, then select x , otherwise select x a ; If x b and x a belong to the same rank, i.e., b then select the individual with the larger crowding distance, i.e., if d(x )>d(x a ), then select x b , otherwise select x a . Repeat this process until enough parents are selected to form a mating pool b . Next, the crossover and mutation method can be used to randomly select two parents x and x p from the mating pool, perform the crossover operation to generate two offspring x q and x c , and their calculation method is: d In the formula, x p and x q represent the network parameter vectors of the two parents, x c and x d represent the network parameter vectors of the two offspring, and |·| represents the absolute value operation. Perform the mutation operation on each offspring to generate a new solution x e , and its calculation method is: e x c =x c +δz

[0130] In the formula, x e represents the network parameter vector of an offspring, x i represents the network parameter vector of a new solution, δ represents the mutation intensity.

[0131] denote a random vector subject to the standard normal distribution, and I denote the identity matrix. Repeat this process until a sufficient number of new solutions are generated to form an offspring population

[0131] Next, the parent population and the offspring population are combined into a total population Calculate the objective function value f(x) of each individual, and divide the total population into different ranks according to the principle of non-dominated sorting where denotes the first rank, i.e., the optimal rank, denotes the L-th rank, i.e., the worst rank, satisfying the following conditions:

[0132]

[0133] where denotes that x i dominates x j , that is:

[0134]

[0135] Starting from the first rank, individuals in each rank are added to a new population in turn until the size of the new population reaches the preset population size N or exceeds the preset population size N. If it exceeds the preset population size N, calculate and sort the crowding distance of the individuals in the current rank, and select the individuals with a larger crowding distance so that the size of the new population is exactly equal to the preset population size N, that is: where |·| represents the size of the set. Take the new population as the population of the next generation and return to step 2, repeat this process until the preset number of evolutionary generations G is reached or the preset stop conditions, such as convergence, stability, etc., are met

[0136] Based on any of the above embodiments, in step 120, taking the multi-agent as a node, a first graph structure is constructed based on the data to be decision-making, including:

[0137] Taking the multi-agent as a node and the relationship between agents as edges, a first graph structure at the previous moment is constructed based on the data to be decision-making of the multi-agent at the previous moment

[0138] Based on the dynamic graph neural network and the first graph structure at the previous moment, update the first graph structure, and based on the graph convolutional network and the updated first graph structure, obtain the first graph structure at the current moment

[0139] Specifically, first, multi - agents are used as nodes, and the relationships between agents are used as edges. Based on the data to be decided by the multi - agents at the previous moment, the first graph structure at the previous moment is constructed. It can be understood that the graph structure in the greenhouse is regarded as a dynamically changing process. Thus, the first graph structure at the previous moment can be processed by a dynamic graph neural network to capture the evolution and changes of the graph structure, adapt to the dynamically changing environment, and improve the robustness and flexibility of the first graph structure.

[0140] In one embodiment, the method of using a dynamic graph convolutional network is adopted to model the change of the first graph structure as a random process, that is:

[0141]

[0142] where, represents the first graph structure at time t, represents the node feature matrix at time t, represents the edge feature matrix at time t, N represents the number of nodes, D represents the dimension of node features, f represents the change function of the first graph structure, represents the external input at time t, such as the feature vector of multi - modal data, represents the random noise at time t, such as the uncertainty or noise of the first graph structure.

[0143] Then, through the method of graph convolutional network, the topological information and node features of the graph structure can be convolved to realize the feature learning and representation of the dynamic graph structure, that is:

[0144] H t = g(V t , E t )

[0145] where, represents the feature matrix of the first graph structure at time t, K represents the dimension of the first graph structure features, g represents the function of the graph convolutional network, and its specific form is:

[0146] g(V t , E t ) = σ(E t V t W)

[0147] where, σ represents the activation function, such as the ReLU function, represents the weight matrix of the graph convolutional network. Thus, in this way, the embodiments of the present invention realize the feature learning and representation of the dynamic graph structure, and obtain the graph structure feature vector of each node, that is, where, represents the graph structure feature vector of the i - th node at time t.

[0148] The method provided by the embodiments of the present invention models the mutual relationship between each area in the greenhouse and the crops as a dynamic graph structure, and uses the method of dynamic graph neural network to capture the evolution and changes of the graph structure, adapt to the dynamically changing environment, and improve the robustness and flexibility of the graph structure.

[0149] Based on any of the above embodiments, in step 110, obtaining the decision-making data to be made by multiple agents includes:

[0150] Obtaining multi-source decision-making data of the multiple agents;

[0151] Extracting the source data features of each data source of the multi-source decision-making data, and respectively performing feature fusion on the source data features of each data source of the multiple agents based on a tensor fusion network to obtain the decision-making data to be made by the multiple agents.

[0152] Specifically, first, data on the spatial environment and substrate characteristics in the greenhouse can be collected regularly or in real time through various sensors, such as temperature sensors, humidity sensors, light sensors, substrate temperature sensors, substrate drainage ratio sensors, substrate EC sensors, substrate pH value sensors, etc., and the data is stored in the database in numerical form. Data on the plant growth status in the greenhouse is collected regularly or in real time using various image devices, such as cameras, and the data is stored in the database in the form of images or videos. Data on relevant knowledge and experience in the greenhouse is collected regularly or in real time using various text sources, such as expert reports, agricultural literature, user feedback, etc., and the data is stored in the database in text form to obtain the multi-source decision-making data of each area. Then, through the method of tensor decomposition, the multi-modal data can be represented as a high-dimensional tensor, that is:

[0153]

[0154] In the formula, represents the multi-modal data tensor, I N represents the dimension of the Nth modality, and N represents the total number of modalities.

[0155] Then, the method of parallel factor analysis can be used to decompose the tensor into multiple low-dimensional factor matrices, that is:

[0156]

[0157] Among them, R represents the number of factors, represents the rth factor vector of the nth modality, and ° represents the outer product of vectors. Thus, the dimensionality reduction and fusion of the multi-source decision-making data are realized, and a low-dimensional tensor core is obtained, that is: Among them, represents the tensor core, and its elements are: Next, by using methods such as convolutional neural networks and recurrent neural networks, feature extraction and encoding can be performed on multi-source decision-making data such as images, videos, and texts, obtaining a feature matrix for each modality, that is, the source data features of each data source, which can be expressed as where, V (n) represents the feature matrix of the nth modality, that is, the source data features, and D n represents the feature dimension of the nth modality. Further, the method of the tensor fusion network fuses the feature matrices of different modalities into a unified feature matrix, that is, the data to be decision-making here, which can be expressed as:

[0158] V = W1V (1) + W2V (2) +…+ W N V (N)

[0159] where, represents the fused feature matrix, that is, the data to be decision-making after fusion; I represents the number of data, D represents the fused feature dimension, represents the weight matrix of the nth modality. Thus, the feature learning and representation of multi-source decision-making data are realized, obtaining the feature vector of each agent, that is, the data to be decision-making, and it can be expressed as: where, v i represents the feature vector of the ith multi-source decision-making data.

[0160] It should be noted that it provides a data basis for subsequent graph structure modeling. The data set contains the following contents: Data features: The feature vector of each data, that is, v i , representing the feature vector of the ith multi-source decision-making data. Data labels: The label vector of each data, that is, represents multiple evaluation indicators of the data, such as greenhouse environmental quality, crop growth status, crop yield, etc., and C represents the number of evaluation indicators. Data relationships: The relationship weights between each pair of data, that is, represents the similarity or correlation between data, such as spatial distance, substrate type, plant variety, etc. Thus, the data to be decision-making can be expressed as a triple, that is: (V, Y, W). Among them, represents the data feature matrix, represents the data label matrix, represents the data relationship matrix. It should also be noted that by using the multi-modal multi-source decision-making data in the greenhouse, the quality and integrity of the data to be decision-making are improved, the expression ability and information volume of the data are enhanced, thereby improving the accuracy and reliability of the optimal decision-making of greenhouse water and fertilizer.

[0161] Based on any of the above embodiments, the method provided by the embodiments of the present invention applies the water and fertilizer decision-making model to the decision optimization problem of greenhouse tomato cultivation. According to the value function or policy function output by the model, the tomatoes to be planted are selected and the parameters of the greenhouse are adjusted to improve the yield and quality of tomatoes and reduce the operating cost of the greenhouse. Specifically, the method of transfer learning can be used to apply the water and fertilizer decision-making model to the decision optimization problem of greenhouse tomato cultivation. According to the value function or policy function output by the water and fertilizer decision-making model, the irrigation time, irrigation amount, nutrient solution concentration, and nutrient ratio are selected to improve the yield and quality of tomatoes and reduce the operating cost of the greenhouse.

[0162] In addition, the method of transfer learning can also be used to explore the transfer and generalization capabilities of the model in other agricultural scenarios, such as hydroponics, vertical farming, etc., and verify the generality and scalability of the model. Specifically, the following steps can be used to achieve the transfer of the model: According to the actual situation of the target domain, such as planting method, crop type, environmental conditions, etc., determine the number and location of the nodes in the target domain, as well as the relationship between the nodes, and construct the graph structure of the target domain, that is: Among them, represents the graph structure of the target domain, represents the feature matrix of the nodes, represents the feature matrix of the edges, N′ represents the number of nodes, and D′ represents the dimension of the node features. Then, according to the multi-modal data in the target domain, such as sensors, images, videos, texts, etc., the features of each node are updated and fused to construct a data set, that is, (V′, Y′, W′). Among them, represents the data feature matrix, represents the data label matrix, represents the data relationship matrix, I′ represents the number of data, and C′ represents the number of evaluation indicators. Further, according to the data sets and graph structures of the source domain and the target domain, the method of domain adaptation can be used to align and adapt the features of the source domain and the target domain, reduce the differences between domains, and improve the performance of the model in the target domain, thereby verifying the generality and scalability of the model.

[0163] Here, the following steps can be used to achieve domain adaptation: The method of the feature extractor can be used to extract the shared feature representation from the data feature matrices of the source domain and the target domain, that is: Z = φ(V), Z′ = φ(V′). Among them, represents the shared feature matrix of the source domain, represents the shared feature matrix of the target domain, E represents the dimension of the shared features, φ represents the function of the feature extractor, and its specific form is: φ(V) = σ(VWφ + bφ). Among them, σ represents the activation function, such as the ReLU function, Denote the weight matrix and bias vector of the feature extractor. Next, the method of the domain discriminator can be used to discriminate the domain labels from the shared feature matrices of the source domain and the target domain, i.e., D = ψ(Z), D′ = ψ(Z′). Wherein, denote the domain label matrix of the source domain, denote the domain label matrix of the target domain, ψ denotes the function of the domain discriminator, and its specific form is: ψ(Z) = Softmax(ZWψ + bψ). Wherein, Softmax denotes the normalized exponential function, which is used to convert the output of the domain discriminator into a probability distribution, denote the weight matrix and bias vector of the domain discriminator. Then, the method of adversarial learning can be used to alternately optimize the feature extractor and the domain discriminator, so that the feature extractor can extract domain-invariant features, making it difficult for the domain discriminator to distinguish the features of the source domain and the target domain, thereby realizing the feature alignment and adaptation between the source domain and the target domain, reducing the differences between domains, improving the performance of the model in the target domain, and thus verifying the generality and scalability of the model. Here, adversarial learning can be realized through the following steps: fix the parameters Wφ and bφ of the feature extractor, and update the parameters Wψ and bψ of the domain discriminator, so that the domain discriminator can accurately discriminate the features of the source domain and the target domain, i.e.:

[0164]

[0165] In the formula, L d (Wψ, bψ) denotes the loss function of the domain discriminator, Di1 denotes the probability that the i-th feature of the source domain belongs to the source domain, D′ i2 denotes the probability that the i-th feature of the target domain belongs to the target domain.

[0166] Next, fix the parameters Wψ and bψ of the domain discriminator, and update the parameters Wφ and bφ of the feature extractor, so that the feature extractor can extract domain-invariant features, making it difficult for the domain discriminator to distinguish the features of the source domain and the target domain, i.e.:

[0167]

[0168] Wherein, L f (Wφ, bφ) denotes the loss function of the feature extractor, Di2 denotes the probability that the i-th feature of the source domain belongs to the target domain, D′ i1 denotes the probability that the i-th feature of the target domain belongs to the source domain. Repeat the above two steps until the preset number of iterations T is reached, or the preset stop conditions are met, such as convergence, stability, etc.

[0169] Then, based on the shared feature matrix of the source domain and the target domain, use the graph attention network as an approximator of the value function or the policy function to output the value function or the policy function of each node, that is:

[0170]

[0171] In the formula, represents the value function of the i-th node at time t, represents the policy function of the i-th node at time t, represents the feature vector of the i-th node in the L-th layer, represents the weight vector or matrix of the value function or the policy function, and Softmax represents the normalized exponential function, which is used to convert the output of the policy function into a probability distribution.

[0172] According to the output of the value function or the policy function, select the crops to be planted and adjust the parameters of agriculture to achieve the improvement of the yield and quality of crops and the reduction of the operating cost of agriculture, that is:

[0173]

[0174] Among them, represents the action vector of the i-th node at time t, represents the irrigation time of the i-th node at time t, represents the irrigation amount of the i-th node at time t, represents the nutrient solution concentration of the i-th node at time t, represents the nutrient ratio of the i-th node at time t.

[0175] It should be noted that the method of transfer learning is used to transfer the water and fertilizer decision-making model from the decision optimization problem of greenhouse tomato planting to other agricultural scenarios, such as hydroponics, vertical farming, etc. By aligning and adapting the features of the source domain and the target domain, the differences between domains are reduced, and the performance of the model in the target domain is improved, thereby verifying the generality and scalability of the model.

[0176] Furthermore, the application and generalization of the model can be achieved using the following steps: According to the evaluation index and optimization result of the model, select the Pareto optimal solution of the model, that is:

[0177]

[0178] In the formula, represents the Pareto optimal solution of the model, represents the Pareto optimal set of the model, represents the objective function vector of the model, P represents the number of network parameters, and M represents the number of objective functions.

[0179] Next, use the Pareto optimal solution of the model as the value of the network parameters, i.e.:

[0180] w0 = x *

[0181] where, represents the initial value of the network parameters, and P represents the number of network parameters.

[0182] Deploy the model to the decision optimization problem of greenhouse tomato cultivation, or other agricultural scenarios, such as hydroponics, vertical farming, etc. According to the value function or policy function output by the model, select the crops to be planted and adjust the agricultural parameters to achieve the improvement of crop yield and quality, as well as the reduction of agricultural operation costs, i.e.:

[0183]

[0184] where, represents the action vector of the i-th node at time t, represents the irrigation time of the i-th node at time t, represents the irrigation amount of the i-th node at time t, represents the nutrient solution concentration of the i-th node at time t, represents the nutrient ratio of the i-th node at time t.

[0185] It should be noted that through the evaluation index and optimization result of the water and fertilizer decision-making model, the application and generalization of the water and fertilizer decision-making model in greenhouse tomato cultivation and other agricultural scenarios can be obtained, and the comprehensive evaluation and optimization of the greenhouse environment and crop growth conditions, as well as the migration and generalization of other agricultural scenarios can be realized, so as to verify the generality and scalability of the model.

[0186] Based on any of the above embodiments, the training method of the water and fertilizer decision-making model for the greenhouse includes three stages: data acquisition, data processing, and model construction. In the data acquisition stage, environmental data, crop data, and water and fertilizer data can be obtained. Among them, for environmental data: environmental factors such as temperature, humidity, light, and carbon dioxide in the greenhouse have an important impact on crop growth and water and fertilizer requirements. It can be collected in real time through sensor devices installed in the greenhouse (such as temperature and humidity sensors, light sensors, carbon dioxide sensors, etc.). The unit symbol, value range, and collection frequency of the data can be adjusted according to the actual situation and requirements. It is recommended to collect once every 15 minutes to ensure the timeliness and accuracy of the data.

[0187] Regarding crop data: Crop characteristics such as the type, quantity, growth stage, physiological indicators, and yield of crops in the greenhouse have a direct impact on the utilization rate and cost of water and fertilizers. It can be collected by regularly taking pictures with camera devices (such as smart cameras) installed in the greenhouse or through manual observation and recording. It is recommended to collect data once every two days to ensure the integrity and reliability of the data.

[0188] Regarding water and fertilizer data: Water and fertilizer management parameters such as irrigation time, irrigation volume, nutrient solution concentration, and nutrient ratio in the greenhouse play a decisive role in the growth status of crops and water and fertilizer efficiency. It is automatically controlled and recorded by controller devices (such as intelligent irrigation controllers, intelligent fertilizer applicators, etc.) installed in the greenhouse or collected through manual operation and recording. It is recommended to collect data once after each irrigation or fertilization to ensure the accuracy and effectiveness of the data.

[0189] In the data processing stage, first perform data cleaning to remove invalid data, abnormal data, duplicate data, missing data, etc., and improve the quality and consistency of the data. The pandas library in Python can be used for data cleaning, and its provided functions can be used to perform operations such as data screening, deletion, filling, and replacement using dropna, drop_duplicates, fillna, replace, etc.

[0190] Then perform data fusion. For multi-modal data, data fusion is required to effectively fuse different data sources and improve the data expression ability and information volume. The numpy library in Python can be used for data fusion, and its provided functions can be used to perform operations such as data concatenation, stacking, horizontal merging, and vertical merging using concatenate, stack, hstack, vstack, etc.

[0191] Furthermore, perform data standardization. For the fused data, data standardization is required to uniformly scale the numerical range of the data, eliminate the dimension and distribution differences of the data, and improve the comparability and stability of the data. The sklearn library in Python can be used for data standardization, and its provided functions can be used to perform operations such as minimum-maximum scaling, mean-variance scaling, and median absolute deviation scaling of the data using MinMaxScaler, StandardScaler, RobustScaler, etc.

[0192] Finally, for the standardized data, data storage is required. The structuring and storage of data facilitate data reading and usage. The sqlite3 library in Python can be used for data storage, and its provided functions such as connect, cursor, execute, commit, and close are used for database connection, creation, insertion, update, and closing operations respectively.

[0193] In the model construction stage, first, based on the dynamic graph neural network, the mutual relationships between various regions and crops in the greenhouse are modeled as a dynamic graph structure to capture the evolution and changes of the graph structure, adapt to the dynamically changing environment, and improve the robustness and flexibility of the graph structure. The PyTorch Geometric library in Python can be used to construct the dynamic graph neural network, and its provided functions such as Data, DynamicEdgeConv, and GNNExplainer are used for operations such as graph data representation, dynamic edge convolution calculation, and graph neural network explanation. The optimal performance requirements and configurations of the dynamic graph neural network can be adjusted according to the actual situation and requirements. The following core model parameter configurations are recommended:

[0194]

[0195]

[0196] Then, based on the graph attention network as an approximator of the value function or policy function, the method of multi-head self-attention mechanism is used to achieve multi-angle and multi-scale information fusion, improving the performance and efficiency of the graph attention network. The PyTorch library in Python can be used to construct the graph attention network, and its provided functions such as MultiheadAttention, Linear, and Softmax are used for operations such as multi-head self-attention calculation, linear transformation, and probability normalization. The optimal performance requirements and configurations of the graph attention network can be adjusted according to the actual situation and requirements. The following core model parameter configurations are recommended:

[0197]

[0198] In addition, based on multi-agent reinforcement learning, the states, actions, and rewards of each agent are represented as vectors. The graph attention mechanism is used to calculate the influence of each agent on other agents and the attention weights of each agent, so as to achieve effective coordination and cooperation among multiple agents. The Python library PyMARL can be used to construct multi-agent reinforcement learning. Using the functions it provides, operations such as running the environment, defining agents, updating learners, and replaying experiences are performed respectively using Runner, Agent, Learner, ReplayBuffer, etc. The optimal performance requirements and configurations of multi-agent reinforcement learning can be adjusted according to the actual situation and needs. The following core model parameter configurations are recommended:

[0199]

[0200]

[0201] Based on any of the above embodiments, Figure 2 is a schematic structural diagram of the training device for the water and fertilizer decision-making model of the greenhouse provided by the present invention, as Figure 2 shown. The device includes:

[0202] An acquisition unit 210, which acquires the data to be decision-making of multiple agents, and the multiple agents at least include each area of the greenhouse;

[0203] A feature fusion unit 220, taking the multiple agents as nodes, constructs a first graph structure based on the data to be decision-making, determines the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determines the water and fertilizer decisions of each agent based on the graph structure fusion feature;

[0204] A training unit 230, aiming to maximize the decision-making rewards of each agent, optimizes the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model; the decision-making rewards are determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent.

[0205] The device provided by the embodiment of the present invention, by taking multiple agents as nodes, constructs a first graph structure based on the data to be decision-making, extracts and fuses the graph structure fusion feature based on the graph attention network, improves the processing ability of the data to be decision-making. And, the initial water and fertilizer decision-making model is optimized through multi-agent reinforcement learning to obtain more coordinated water and fertilizer decisions among each area, and the water and fertilizer utilization rate of the greenhouse is improved.

[0206] Based on any of the above embodiments, the graph attention network layer includes a self-attention sublayer and a feed-forward sublayer;

[0207] The feature fusion unit is specifically used for:

[0208] Based on the self-attention sub-layer and the first graph structure, apply the multi-head self-attention mechanism to determine the attention weights of each attention head and the feature representations of each attention head, and based on the attention weights of each attention head and the feature representations of each attention head, obtain the initial graph structure features of the first graph structure;

[0209] Based on the feed-forward sub-layer, perform a non-linear transformation on the initial graph structure features to determine the graph structure fusion features of the first graph structure.

[0210] Based on any of the above embodiments, the training unit is specifically configured to:

[0211] Taking the multi-agent as nodes, based on the water and fertilizer decisions, decision rewards of each agent, and the data to be decision-making of the multi-agent, construct a second graph structure;

[0212] Based on the graph attention mechanism and the second graph structure, determine the decision fusion features of the second graph structure;

[0213] Based on the decision fusion features, with the goal of maximizing the decision rewards of each agent, optimize the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model.

[0214] Based on any of the above embodiments, the training unit is further specifically configured to:

[0215] Based on the decision fusion features, determine the coordinated optimization strategies of each agent;

[0216] Based on the coordinated optimization strategies of each agent and the meta-learning algorithm, with the goal of maximizing the decision rewards of each agent, optimize the initial water and fertilizer decision-making model to obtain the final water and fertilizer decision-making model.

[0217] Based on any of the above embodiments, the feature fusion unit is specifically configured to:

[0218] Taking the multi-agent as nodes and the relationships between each agent as edges, based on the data to be decision-making of the multi-agent at the previous moment, construct the first graph structure at the previous moment;

[0219] Based on the dynamic graph neural network and the first graph structure at the previous moment, update the first graph structure, and based on the graph convolutional network and the updated first graph structure, obtain the first graph structure at the current moment.

[0220] Based on any of the above embodiments, the acquisition unit is specifically configured to:

[0221] Acquire the multi-source decision-making data of the multi-agent;

[0222] Extract the source data features of each data source of the multi-source decision-making data, and perform feature fusion on the source data features of each data source of the multi-agent based on a tensor fusion network to obtain the decision-making data to be determined for the multi-agent.

[0223] Figure 3 An example of a schematic physical structure diagram of an electronic device is shown in Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330, and a communication bus 340. Among them, the processor 310, the communication interface 320, and the memory 330 complete mutual communication through the communication bus 340. The processor 310 may call the logical instructions in the memory 330 to execute the training method of the water and fertilizer decision-making model for the greenhouse. The method includes: obtaining the decision-making data to be determined for the multi-agent, where the multi-agent at least includes each area of the greenhouse; using the multi-agent as nodes, constructing a first graph structure based on the decision-making data to be determined, determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determining the water and fertilizer decision for each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent to obtain the final water and fertilizer decision-making model; the decision-making reward is determined based on the graph structure fusion feature and the water and fertilizer decision of each agent.

[0224] In addition, when the logical instructions in the above-mentioned memory 330 are implemented in the form of software functional units and sold or used as an independent product, they may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc that can store program codes.

[0225] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the training method of the water and fertilizer decision-making model for the greenhouse provided by the above-mentioned various methods. The method includes: obtaining the decision-making data to be determined by multiple agents, where the multiple agents at least include each area of the greenhouse; using the multiple agents as nodes, constructing a first graph structure based on the decision-making data to be determined, determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determining the water and fertilizer decisions of each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent to obtain the final water and fertilizer decision-making model; the decision-making rewards are determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent.

[0226] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it realizes the training method of the water and fertilizer decision-making model for the greenhouse provided by the above-mentioned various methods. The method includes: obtaining the decision-making data to be determined by multiple agents, where the multiple agents at least include each area of the greenhouse; using the multiple agents as nodes, constructing a first graph structure based on the decision-making data to be determined, determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision-making model, and determining the water and fertilizer decisions of each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision-making model with the goal of maximizing the decision-making rewards of each agent to obtain the final water and fertilizer decision-making model; the decision-making rewards are determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent.

[0227] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative labor.

[0228] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0229] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A training method for a water and fertilizer decision-making model of a greenhouse, characterized in that Including: Obtain the data to be decided for multiple agents, where the multiple agents at least include each area of the greenhouse; Taking the multiple agents as nodes, construct a first graph structure based on the data to be decided, determine the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision model, and determine the water and fertilizer decisions of each agent based on the graph structure fusion feature; Optimize the initial water and fertilizer decision model with the goal of maximizing the decision rewards of each agent to obtain the final water and fertilizer decision model; The decision reward is determined based on the graph structure fusion feature and the water and fertilizer decisions of each agent; The data to be decided includes the environmental data and crop growth data of each area. Specifically, data on the spatial environment and substrate characteristics in the greenhouse are collected regularly or in real time through multiple sensors, and the data is stored in the database in numerical form to obtain the data to be decided for each area; Data on the growth status of plants in the greenhouse are collected regularly or in real time through image devices, and the data is stored in the database in the form of images or videos to obtain the crop growth data of the crops in the area; The graph attention network layer includes a self-attention sub-layer and a feed-forward sub-layer; The determining the graph structure fusion feature of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision model includes: Based on the self-attention sub-layer and the first graph structure, applying the multi-head self-attention mechanism to determine the attention weights of each attention head and the feature representations of each attention head, and based on the attention weights of each attention head and the feature representations of each attention head, obtain the initial graph structure feature of the first graph structure; Perform a non-linear transformation on the initial graph structure feature based on the feed-forward sub-layer to determine the graph structure fusion feature of the first graph structure; The constructing the first graph structure based on the data to be decided with the multiple agents as nodes includes: Taking the multiple agents as nodes, using the relationships between the agents as edges, and constructing the first graph structure at the previous moment based on the data to be decided of the multiple agents at the previous moment; Update the first graph structure based on the dynamic graph neural network and the first graph structure at the previous moment, and obtain the first graph structure at the current moment based on the graph convolutional network and the updated first graph structure.

2. The training method of the water and fertilizer decision-making model for the greenhouse according to claim 1, characterized in that, The optimizing the initial water and fertilizer decision model with the goal of maximizing the decision rewards of each agent to obtain the final water and fertilizer decision model includes: Taking the multiple agents as nodes, construct a second graph structure based on the water and fertilizer decisions, decision rewards of each agent, and the data to be decided of the multiple agents; Determine the decision fusion feature of the second graph structure based on the graph attention mechanism and the second graph structure; Based on the decision fusion feature, optimize the initial water and fertilizer decision model with the goal of maximizing the decision rewards of each agent to obtain the final water and fertilizer decision model.

3. The training method of the water and fertilizer decision-making model for the greenhouse according to claim 2, characterized in that, The optimizing the initial water and fertilizer decision model with the goal of maximizing the decision rewards of each agent based on the decision fusion feature to obtain the final water and fertilizer decision model includes: Based on the decision fusion features, determine the coordinated optimization strategies of the agents; Based on the coordinated optimization strategies of the agents and the meta-learning algorithm, optimize the initial water and fertilizer decision model with the goal of maximizing the decision rewards of the agents to obtain the final water and fertilizer decision model.

4. The training method of the water and fertilizer decision-making model of the greenhouse according to any one of claims 1 to 3, characterized in that The obtaining of the decision-making data of multiple agents includes: Obtain the multi-source decision-making data of the multiple agents; Extract the source data features of each data source of the multi-source decision-making data, and perform feature fusion on the source data features of each data source of the multiple agents respectively based on the tensor fusion network to obtain the decision-making data of the multiple agents.

5. A training device for a water and fertilizer decision-making model of a greenhouse, characterized in that, It includes: An acquisition unit that acquires the decision-making data of multiple agents, where the multiple agents at least include each area of the greenhouse; A feature fusion unit that uses the multiple agents as nodes, constructs a first graph structure based on the decision-making data, determines the graph structure fusion features of the first graph structure based on the graph attention network layer in the initial water and fertilizer decision model, and determines the water and fertilizer decisions of each agent based on the graph structure fusion features; A training unit that optimizes the initial water and fertilizer decision model with the goal of maximizing the decision rewards of the agents to obtain the final water and fertilizer decision model; The decision reward is determined based on the graph structure fusion features and the water and fertilizer decisions of the agents; The decision-making data includes the environmental data and crop growth data of each area. Specifically, data on the spatial environment and substrate characteristics in the greenhouse are collected regularly or in real time through a variety of sensors, and the data is stored in the database in numerical form to obtain the decision-making data of each area; Data on the growth status of plants in the greenhouse are collected regularly or in real time through an image device, and the data is stored in the database in the form of images or videos to obtain the crop growth data of the crops in the area; The graph attention network layer includes a self-attention sublayer and a feed-forward sublayer; The feature fusion unit is specifically used for: Based on the self-attention sublayer and the first graph structure, apply the multi-head self-attention mechanism to determine the attention weights of each attention head and the feature representations of each attention head, and based on the attention weights of each attention head and the feature representations of each attention head, obtain the initial graph structure features of the first graph structure; Perform a non-linear transformation on the initial graph structure features based on the feed-forward sublayer to determine the graph structure fusion features of the first graph structure; The feature fusion unit is also specifically used for: Using the multiple agents as nodes and the relationships between the agents as edges, construct the first graph structure at the previous moment based on the decision-making data of the multiple agents at the previous moment; Update the first graph structure based on the dynamic graph neural network and the first graph structure at the previous moment, and obtain the first graph structure at the current moment based on the graph convolutional network and the updated first graph structure.

6. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, it implements the training method of the water and fertilizer decision model of the greenhouse according to any one of claims 1 to 4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the training method of the water and fertilizer decision model of the greenhouse according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the training method of the water and fertilizer decision-making model of the greenhouse according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Reactive power optimization decision determination method and device, computer equipment and storage medium

    CN115566692A

  • Multi-modal military intelligent auxiliary combat decision-making method based on graph perception Transform

    CN116757497A

Cited By

  • Farmland precise variable rate fertilization control system based on intelligent agent and edge calculation

    CN121771250A

  • A precision variable fertilization control system for farmland based on intelligent agents and edge computing

    CN121771250B