Training method and device for water and fertilizer decision model of greenhouse

Optimizing water and fertilizer decisions through the multi-agent graph attention network model solves the complexity and dynamic problems of water and fertilizer management in the greenhouse, achieves efficient water and fertilizer utilization, and improves the growth environment and operating efficiency of the greenhouse.

CN118586432AActive Publication Date: 2024-09-03INTELLIGENT EQUIPMENT RESEARCH CENTER BEIJING ACADEMY OF AGRICULTURE AND FORESTRY SCIENCES

Patent Information

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

AI Technical Summary

Technical Problem

The existing technology is difficult to adapt to the complex and dynamic environment and crop growth characteristics in the greenhouse, resulting in unsatisfactory water and fertilizer management results and a lack of environmental adaptability and coordination.

Method used

Using a graph attention network model with multiple agents as nodes, the initial water and fertilizer decision model is optimized by constructing a graph structure to integrate features and decision rewards, achieving coordinated water and fertilizer decisions among various regions and improving water and fertilizer utilization.

Benefits of technology

It improves the accuracy and reliability of water and fertilizer decisions, enhances the ability to adapt to complex environments, and improves water and fertilizer utilization and operating efficiency in the greenhouse.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586432A
    Figure CN118586432A
Patent Text Reader

Abstract

The invention provides a training method and device for a water and fertilizer decision model of a greenhouse, and the method comprises the steps: obtaining the to-be-decided data of a multi-agent, and the multi-agent comprises all regions of the greenhouse; constructing a first graph structure based on to-be-decided data by taking the multiple agents as nodes, determining graph structure fusion features based on a graph attention network layer in the initial water and fertilizer decision model, and determining water and fertilizer decisions of the agents based on the graph structure fusion features; and optimizing the initial water and fertilizer decision-making model to obtain a final water and fertilizer decision-making model by taking maximization of the decision-making reward of each agent as a target. According to the method provided by the invention, the first graph structure is constructed based on the to-be-decided data, the graph structure fusion features are obtained based on the graph attention network, and the data processing capability is improved. The model is optimized through multi-agent reinforcement learning, so that a more coordinated water and fertilizer decision is obtained, and the water and fertilizer utilization rate is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

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

[0003] However, 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 nonlinearity, time-varying, and uncertainty, resulting in unsatisfactory water and fertilizer management results. Summary of the invention

[0004] The present invention provides a method and device for training a water and fertilizer decision model for a greenhouse, which are used 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 method for training a water and fertilizer decision model for a greenhouse, comprising:

[0006] Acquire the decision-making data of the multi-agent, wherein the multi-agent includes at least each area of ​​the greenhouse;

[0007] Taking the multiple agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature;

[0008] With the goal of maximizing the decision reward of each intelligent agent, the initial water-fertilizer decision model is optimized to obtain a final water-fertilizer decision model; the decision reward is determined based on the graph structure fusion feature and the water-fertilizer decision of each intelligent agent.

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

[0010] The determining of 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:

[0011] Based on the self-attention sublayer and the first graph structure, applying a multi-head self-attention mechanism, determining an attention weight of each attention head and a feature representation of each attention head, and obtaining initial graph structure features of the first graph structure based on the attention weights of each attention head and the feature representation of each attention head;

[0012] Based on the feed-forward sublayer, a nonlinear transformation is performed on the initial graph structure features to determine the graph structure fusion features of the first graph structure.

[0013] According to a method for training a greenhouse water and fertilizer decision model provided by the present invention, the initial water and fertilizer decision model is optimized based on the goal of maximizing the decision reward of each intelligent agent to obtain a final water and fertilizer decision model, including:

[0014] Taking the multi-agent as a node, constructing a second graph structure based on the water and fertilizer decisions, decision rewards, and pending decision data of the multi-agent;

[0015] Based on the graph attention mechanism and the second graph structure, determining a decision fusion feature of the second graph structure;

[0016] Based on the decision fusion features, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision rewards of each intelligent agent to obtain a final water-fertilizer decision model.

[0017] According to a training method for a greenhouse water and fertilizer decision model provided by the present invention, based on the decision fusion feature, the initial water and fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water and fertilizer decision model, including:

[0018] Based on the decision fusion characteristics, determining the coordination optimization strategy of each intelligent agent;

[0019] Based on the coordinated optimization strategy and meta-learning algorithm of each intelligent agent, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model.

[0020] According to a method for training a greenhouse water and fertilizer decision model provided by the present invention, the multi-agent is used as a node, and a first graph structure is constructed based on the data to be decided, including:

[0021] Taking the multi-agents as nodes and the relationships between the agents as edges, based on the to-be-decided data of the multi-agents at the previous moment, a first graph structure at the previous moment is constructed;

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

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

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

[0025] The source data features of each data source of the multi-source decision data are extracted, and based on the tensor fusion network, the source data features of each data source of the multi-agent are respectively fused to obtain the data to be decided by the multi-agent.

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

[0027] An acquisition unit, which acquires the to-be-decided data of the multi-agent, wherein the multi-agent at least includes each area of ​​the greenhouse;

[0028] a feature fusion unit, taking the multi-agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature;

[0029] The training unit optimizes the initial water-fertilizer decision model with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model; the decision reward is determined based on the graph structure fusion feature and the water-fertilizer decision of each intelligent agent.

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

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

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

[0033] The method and device for training the water and fertilizer decision model of the greenhouse provided by the present invention use multiple agents as nodes, construct a first graph structure based on the data to be decided, extract and fuse the graph structure fusion features based on the graph attention network, and improve the processing ability of the decision data. In addition, the initial water and fertilizer decision model is optimized through multi-agent reinforcement learning to obtain more coordinated water and fertilizer decisions between 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 briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

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

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

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

[0038] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are 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 used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0040] Water and fertilizer management is a key link in greenhouse tomato cultivation, 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 of water and fertilizer.

[0041] There are mainly the following traditional water and fertilizer management methods: ① Methods based on artificial experience. This method mainly relies on the experience and intuition of the grower, and judges the water and fertilizer needs of the crop according to the growth stage and appearance of the crop, as well as the moisture and color of the soil, and then determines the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. based on 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, but the disadvantage is that it is inaccurate, unstable, and unreliable. It is easily affected by the subjective factors of the grower and environmental factors, and it is difficult to ensure the optimization and balance of water and fertilizer, and it is also difficult to achieve precision and intelligence of water and fertilizer. ② Methods based on fixed irrigation plans. This method mainly relies on pre-established irrigation plans, and determines the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. according to the type, variety, growth stage, etc. of the crop. The advantages of this method are normalization and standardization, which can realize the automation and quantification of water and fertilizer, but the disadvantages are the lack of flexibility and adaptability. It is difficult to make real-time adjustments and optimizations based on the multimodal data in the greenhouse and the dynamically changing environment and needs. It is also difficult to consider the relationship and influence between various areas and crops in the greenhouse, resulting in mismatch and imbalance of water and fertilizer, as well as the decline of crop growth and water and fertilizer utilization, and the increase of greenhouse operation costs. ③ Sensor and controller-based method. 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 multimodal data such as soil moisture, soil conductivity, temperature, humidity, light, flow, etc. in the greenhouse, the irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio, etc. are controlled according to preset thresholds or algorithms. The advantages are precision and intelligence, which can realize real-time monitoring and control of water and fertilizer. However, the disadvantages are complexity and costliness, requiring a large amount of equipment and technology, and being susceptible to failure and interference of sensors and controllers. It is difficult to ensure the optimization and balance of water and fertilizer, and it is difficult to fully utilize the multimodal data and dynamic graph structure in the greenhouse, and it is also difficult to achieve coordination and cooperation among multiple agents.

[0042] However, since the environment and crop growth in the greenhouse are complex, nonlinear, time-varying and uncertain, traditional water and fertilizer management methods are often difficult 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 benefits. In view of the above problems, the present invention provides a training method for a greenhouse water and fertilizer decision model to adapt to the complex greenhouse environment and achieve high-efficiency water and fertilizer decision-making. Figure 1 : is a flow chart of the training method of the greenhouse water and fertilizer decision model provided by the present invention, such as Figure 1 As shown, the method includes:

[0043] Step 110, obtaining the data to be decided of the multi-agent, wherein the multi-agent at least includes each area of ​​the greenhouse;

[0044] Here, the water and fertilizer decision-making for controlling each area can be regarded as an intelligent body. The data to be decided include the environmental data and crop growth data of each area; specifically, the data of the spatial environment and substrate characteristics in the greenhouse can be collected regularly or in real time through a variety of sensors, such as temperature sensors, humidity sensors, light sensors, substrate temperature sensors, substrate drainage ratio sensors, substrate EC sensors, substrate pH sensors, etc., and the data can be stored in the database in the form of numerical values ​​to obtain the data to be decided in each area. In addition, the data of the growth status of the plants in the greenhouse can be collected regularly or in real time through imaging devices such as cameras, and the data can be 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 multi-agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature;

[0046] In addition, the initial water and fertilizer decision model here can be a general water and fertilizer decision model that has not been parameter adjusted. Specifically, first, the first graph structure can be constructed by taking multiple agents as nodes and using the data to be decided of each agent. The first graph structure here can reflect the relationship between each region and the crops in the region. Then, the first graph structure can be subjected to feature extraction and feature fusion through the multi-layer graph attention network layer in the initial water and fertilizer decision model to obtain graph structure fusion features, that is, node features and edge features of each node, to achieve full aggregation of local information fusion. Finally, the graph attention network can be used as an approximator of the value function or the strategy function to obtain the water and fertilizer decision of each agent, that is, to obtain the water and fertilizer decision of each agent.

[0047] Step 130, with the goal of maximizing the decision reward of each intelligent agent, the initial water-fertilizer decision model is optimized to obtain a final water-fertilizer decision model; the decision reward is determined based on the graph structure fusion feature and the water-fertilizer decision of each intelligent agent.

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

[0049]

[0050] In the formula, represents the decision reward of the i-th node at time t; represents the crop growth status 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 their weight coefficients.

[0051] Therefore, we can maximize the decision reward as the goal, that is, Among them, T represents the termination time of the decision, and γ represents the discount factor of the reward, so as to optimize the initial water-fertilizer decision-making model to obtain the final water-fertilizer decision-making model, realize coordinated decision-making among multiple agents, i.e., multiple regions, and improve the performance of the water-fertilizer decision-making model in making water-fertilizer decisions.

[0052] The method provided by the embodiment of the present invention uses multiple agents as nodes to construct a first graph structure based on the data to be decided, extracts and fuses the graph structure fusion features based on the graph attention network, and improves the processing ability of the decision data. In addition, the initial water and fertilizer decision model is optimized through multi-agent reinforcement learning to obtain more coordinated water and fertilizer decisions between regions, thereby improving 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 sublayer and a feedforward sublayer;

[0054] The determining of 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:

[0055] Based on the self-attention sublayer and the first graph structure, applying a multi-head self-attention mechanism, determining an attention weight of each attention head and a feature representation of each attention head, and obtaining initial graph structure features of the first graph structure based on the attention weights of each attention head and the feature representation of each attention head;

[0056] Based on the feed-forward sublayer, a nonlinear transformation is performed 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 feedforward sublayer. The first graph structure can be input into the self-attention sublayer, and the first graph structure can be feature extracted and fused through the multi-layer 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 l-th self-attention sublayer. 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 jth point in the l-1th layer.

[0060] In detail, for each graph attention network layer, the scaled dot product attention algorithm can be applied to each attention head in the self-attention sublayer to calculate the attention weight of each node to other nodes, obtain the feature representation and attention weight of each attention head, and realize 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 jth node in the lth layer, Represents a scaling factor used to balance the distribution of attention weights.

[0063] Next, the feature representations obtained by each attention head of each layer can be concatenated to obtain the concatenated feature vector, that is, in, Represents the feature vector of the i-th node output from the l-th self-attention sublayer; represents the Hth head feature vector of the i-th node in the l-th layer. Where K represents the dimension of the feature vector.

[0064] Then, based on the concatenated feature vector and the attention weight, the initial graph structure features output from the attention sublayer are calculated. Furthermore, the initial graph structure features are processed using the residual connection and layer normalization methods, as shown in the following formula:

[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 vector. Then, the feedforward sublayer can perform a nonlinear transformation on the feature vector after the normalization operation by using the multi-layer perceptron method to obtain the graph structure fusion feature of the first graph structure, thereby realizing the feature update and improvement of the node. For example, the graph structure fusion feature of the first graph structure can be obtained by the following formula, as shown in the following formula:

[0067]

[0068] In the formula, MLP represents a multi-layer perceptron, σ represents an 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. Therefore, the feedforward sublayer can process the initial graph structure features based on residual connection and layer normalization to obtain graph structure fusion features and enhance the stability and convergence of the graph attention network. For example, this 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 data to be decided in the greenhouse, enhances the expression ability and information volume of the data, thereby improving the accuracy and reliability of the optimal decision 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 nonlinear relationships in the greenhouse, as well as the dynamic and uncertain environment, and has stronger generalization and adaptability.

[0071] Based on any of the above embodiments, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model, including:

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

[0073] Based on the graph attention mechanism and the second graph structure, determining a decision fusion feature of the second graph structure;

[0074] Based on the decision fusion features, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision rewards of each intelligent agent to obtain a final water-fertilizer decision model.

[0075] Specifically, first, we can construct a second graph structure by taking multiple agents as nodes, taking the water and fertilizer decisions of each agent as actions, taking the decision rewards as rewards, and taking the waiting data of multiple agents as states. The second graph structure here can reflect the interaction between multiple agents. Then, we can represent the state, action, and reward of each agent as a vector based on the Markov decision process, 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 decision-making data of the i-th node at time t, The feature vector representing 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 ith 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 distribution ratio of the i-th node at time t. Represents the reward value of the ith agent at time t.

[0079] Next, the graph attention mechanism can be used to calculate the influence of each agent on other agents in the second graph structure, as well as the attention weight of each agent, so as to achieve information exchange and collaboration between multiple agents, that is, to obtain the decision fusion feature of the second graph structure. The decision fusion feature here can be calculated by the following formula:

[0080]

[0081] In the formula, Ii t Represents the influence vector of the i-th agent at time t on other agents; represents the influence weight of the i-th agent on the j-th agent at time t; represents the action vector of the jth agent at time t; Wi t represents the attention weight of the i-th agent at time t; represents the attention weight of the i-th agent to the j-th agent at time t; represents the decision reward vector of the jth agent at time t. and It can be calculated by the following formula:

[0082]

[0083] In the formula, represents the query vector of the i-th agent at time t; represents the key vector of the jth agent at time t; represents the value of the j-th agent at time t; and Represents a scaling factor used to balance the distribution of influence weights and attention weights.

[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 dimensions of each head are L / H, 4 / H and 1 / H. The influence weight, attention weight, influence vector and attention weight of each head are calculated respectively, and then the influence vectors and attention weights of the H heads are concatenated to obtain the influence vector and attention weight of each agent at time t, that is:

[0085]

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

[0087]

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

[0089] In addition, the graph attention network can be used as an approximator of the value function or policy function, that is, the coordinated water and fertilizer decisions of each agent can be optimized based on the decision fusion characteristics. Furthermore, the decision reward of the multi-agent that maximizes the benefit can be optimized by the deep deterministic policy gradient method to obtain a water and fertilizer decision model that effectively coordinates and cooperates among multiple agents. For example, the deep deterministic policy gradient update can be implemented by the following formula, as shown below:

[0090]

[0091] Where J(π) represents the performance function of the policy function; w a and w q A weight vector or matrix representing the policy function and the value function; represents the approximation of the value function of the ith agent at time t; represents the approximation of the strategy function of the ith agent at time t; ρ μ represents the state distribution of the policy function; represents the experience replay buffer, represents the objective value function of the ith agent at time t; γ represents the discount factor of the reward.

[0092] Thus, the update and optimization of the value function and strategy function of each agent are realized, thereby realizing the output of the coordination strategy of each agent, namely:

[0093]

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

[0095] The method provided by the embodiment of the present invention uses multiple agents as nodes, constructs a second graph structure based on the water and fertilizer decisions, decision rewards, and pending decision data of each agent, 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, and optimizes the initial water and fertilizer decision model to obtain the final water and fertilizer decision model. That is, the multi-agent reinforcement learning method based on the graph attention mechanism represents the state, action, and reward of each agent as a vector. The graph attention mechanism is used to calculate the influence of each agent on other agents, as well as the attention weight of each agent, to achieve effective coordination and cooperation among multiple agents. With the goal of maximizing the decision rewards, the parameters of the initial water and fertilizer decision model are optimized to obtain a water and fertilizer decision model that ultimately achieves effective coordination and cooperation among multiple agents, thereby improving the water and fertilizer utilization rate of the greenhouse.

[0096] Based on any of the above embodiments, the initial water-fertilizer decision model is optimized based on the decision fusion feature with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model, including:

[0097] Based on the decision fusion characteristics, determining the coordination optimization strategy of each intelligent agent;

[0098] Based on the coordinated optimization strategy and meta-learning algorithm of each intelligent agent, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model.

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

[0100] In one embodiment, the network parameters of the initial water and 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 long-term cumulative rewards, and use techniques such as experience replay and target network to improve stability and convergence. In addition, the update of network parameters based on meta-learning methods can be to regard the process of network parameter update as a learning process, and use meta-learning algorithms such as model-independent meta-learning to quickly adapt to new environments and tasks and improve the speed and effect of network parameter updates. In one embodiment, the network parameters can be initialized as a meta-parameter by using a model-independent meta-learning method, that is:

[0101]

[0102] In the formula, w0 represents the initial value of the network parameter, 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, thereby achieving generalization capabilities on different tasks. That is:

[0104]

[0105] In the formula, w i ′ represents the updated value of the network parameters on the i-th task; w0′ represents the updated value of the meta-parameter; η and ξ represent the learning rate; 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 the rapid adaptation of network parameters and optimization of meta-parameters are achieved based on the meta-learning method, thereby improving the speed and effect of network parameter updating of the initial water and fertilizer decision-making model.

[0107] In the training process of the initial water and fertilizer decision model, the state, action and reward of each agent can be stored in an experience pool through the experience replay method, and a batch of data can be randomly sampled from it to update the network parameters, thereby breaking the temporal correlation of the data and improving the utilization of the data, that is:

[0108]

[0109] in, 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] In addition, the network parameters of the value function or policy function of each agent can be copied to a target network through the target network method to calculate the target value function or target policy function, thereby reducing the oscillation of network parameter updates and improving the stability of network parameter updates. That is:

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

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

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

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

[0115] In detail, the multi-objective optimization method is used to regard the evaluation and optimization of the model as a multi-objective problem, namely:

[0116] minf(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 mth objective function of the model, M represents the number of objective functions, and P represents the number of network parameters.

[0118] The multiple evaluation indicators here, that is, the multiple 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 output 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; represents the water and fertilizer utilization rate of the i-th node at time T; Indicates 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, the method of meta-learning is used to quickly adapt to new environments and tasks, improve the speed and effect of network parameter updates, and use techniques such as experience replay and target networks to improve stability and convergence. Finally, using the method of multi-objective optimization, the evaluation and optimization of the model is regarded as a multi-objective problem, considering multiple benefit evaluation indicators (water and fertilizer utilization rate, cost, output, etc.), using non-dominated sorting genetic algorithms, etc., to find the Pareto optimal solution of the model, improve the comprehensive performance and balance of the model. Thus, efficient collaboration between multiple agents and a good balance between multiple objectives can be achieved, thereby improving the efficiency and benefits of the 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 multi-agents and multi-objectives in the greenhouse, and has stronger collaborative ability and optimization ability.

[0122] It should also be noted that the embodiment of the present invention uses a non-dominated sorting genetic algorithm method to divide each solution of the water-fertilizer decision-making model into different levels according to the principle of non-dominated sorting, uses a crowding distance method to calculate the crowding degree of each solution in the target space, uses a tournament selection method to select excellent solutions according to the level and crowding distance, and uses a crossover mutation method to generate new solutions, thereby finding the Pareto optimal solution of the water-fertilizer decision-making model and improving the comprehensive performance and balance of the water-fertilizer decision-making model.

[0123] In detail, the specific steps of the non-dominated sorting genetic algorithm are as follows: Initialize a population Each individual x represents a solution of the model, that is, the value of the network parameter. The objective function value f(x) of each individual is calculated, and the population is divided into different levels according to the principle of non-dominated sorting. in represents the first level, i.e. the best level, Indicates the Lth level, i.e. the worst level, which satisfies the following conditions: in, Represents x i dominatex j ,Right now: Calculate the crowding distance d(x) of each individual, that is, the degree of crowding of each individual in the target space, which is calculated as follows:

[0124]

[0125] In the formula, xi+1 and xi-1 represent two individuals adjacent to x on the mth objective function. and Denote the maximum and minimum values in the population for 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 b . Compare their ranks and crowding distances, and select an individual as a parent according to the following rules: If \(x\) a and \(x\) b belong to different ranks, i.e., and \(k\neq l\), then select the individual with the higher rank, i.e., if \(k < l\), then select \(x\) a , otherwise select \(x\) b ; If \(x\) a and \(x\) b belong to the same rank, i.e., then select the individual with the larger crowding distance, i.e., if \(d(x\) a ) > \(d(x\) b ), then select \(x\) a , otherwise select \(x\) b . Repeat this process until a sufficient number of parents are selected to form a mating pool Next, the crossover and mutation method can be used to randomly select two parents \(x\) and \(x\) p from the mating pool q , perform a crossover operation to generate two offspring \(x\) c and \(x\) d , and their calculation method is:

[0127]

[0128] 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 \(|\cdot|\) represents the absolute value operation. Perform a mutation operation on each offspring to generate a new solution \(x\) e , and its calculation method is:

[0129] \(x\) e = \(x\) c + \(\delta z\)

[0130] In the formula, \(x\) c represents the network parameter vector of an offspring, \(x\) e represents the network parameter vector of a new solution, \(\delta\) represents the mutation intensity, represents a random vector that follows a standard normal distribution, and I represents the identity matrix. Repeat this process until a sufficient number of new solutions are generated to form a sub-population

[0131] Next, the parent population and progeny population Merge into one population Calculate the objective function value f(x) of each individual, and divide the total population into different levels according to the principle of non-dominated sorting in represents the first level, i.e. the best level, Indicates the Lth level, i.e. the worst level, which satisfies the following conditions:

[0132]

[0133] in, Represents x i Dominate x j ,Right now:

[0134]

[0135] Starting from the first level, add individuals of each level 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, the crowding distance of the individuals at the current level is calculated and sorted, and the individuals with larger crowding distance are selected so that the size of the new population is exactly equal to the preset population size N, that is: Here, |·| represents the size of the set. As the next generation of population And return to step 2 and repeat the process until the preset evolutionary generation G is reached, or the preset stopping conditions such as convergence, stability, etc. are met.

[0136] Based on any of the above embodiments, in step 120, taking the multiple agents as nodes and constructing a first graph structure based on the data to be decided, the method includes:

[0137] Taking the multi-agents as nodes and the relationships between the agents as edges, based on the to-be-decided data of the multi-agents at the previous moment, a first graph structure at the previous moment is constructed;

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

[0139] Specifically, first, multiple agents are used as nodes, and the relationships between agents are used as edges. Based on the decision-making data of multiple 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. Therefore, the first graph structure at the previous moment can be passed through a dynamic graph neural network to capture the evolution and change 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, a dynamic graph convolutional network method is used to model the change of the first graph structure as a random process, namely:

[0141]

[0142] in, 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, and f represents the change function of the first graph structure. Represents the external input at time t, such as the feature vector of multimodal data, Represents the random noise at time t, such as the uncertainty or noise of the first graph structure.

[0143] Next, the topological information and node features of the graph structure can be convolved through the graph convolutional network method to achieve feature learning and representation of the dynamic graph structure, namely:

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

[0145] in, Represents the feature matrix of the first graph structure at time t, K represents the dimension of the first graph structure feature, and g represents the function of the graph convolutional network, which is in the following specific form:

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

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

[0148] The method provided by the embodiment of the present invention models the relationship between various areas and crops in the greenhouse as a dynamic graph structure, uses the dynamic graph neural network method to capture the evolution and changes of the graph structure, adapts to the dynamically changing environment, and improves the robustness and flexibility of the graph structure.

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

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

[0151] The source data features of each data source of the multi-source decision data are extracted, and based on the tensor fusion network, the source data features of each data source of the multi-agent are respectively fused to obtain the data to be decided by the multi-agent.

[0152] Specifically, first, a variety of sensors, such as temperature sensors, humidity sensors, light sensors, substrate temperature sensors, substrate drainage ratio sensors, substrate EC sensors, substrate pH sensors, etc., can be used to collect data on the spatial environment and substrate characteristics in the greenhouse regularly or in real time, and store the data in the database in the form of numerical values. Use a variety of imaging devices, such as cameras, to collect data on the growth status of plants in the greenhouse regularly or in real time, and store the data in the form of images or videos in the database. Use a variety of text sources, such as expert reports, agricultural literature, user feedback, etc., to collect data on relevant knowledge and experience in the greenhouse regularly or in real time, and store the data in the form of text in the database to obtain multi-source decision data for each region. Then, the multimodal data can be represented as a high-dimensional tensor through the method of tensor decomposition, that is:

[0153]

[0154] In the formula, Represents a multimodal data tensor, I N represents the dimension of the Nth mode, and N represents the total number of modes.

[0155] Next, we can use the parallel factor analysis method to decompose the tensor into multiple low-dimensional factor matrices, namely:

[0156]

[0157] Where R represents the number of factors. represents the rth factor vector of the nth mode, and ° represents the outer product of the vector. Thus, the dimensionality reduction and fusion of multi-source decision data are achieved, and a low-dimensional tensor core is obtained, namely: in, Represents a tensor core, whose elements are: Next, we can use methods such as convolutional neural networks and recurrent neural networks to extract and encode features of multi-source decision data such as images, videos, and texts, and obtain the feature matrix of each modality, that is, the source data features of each data source, which can be expressed as Among them, V (n) Represents the feature matrix of the nth mode, that is, the source data features, D n Represents the feature dimension of the nth mode. Furthermore, the tensor fusion network method fuses the feature matrices of different modes into a unified feature matrix, that is, the decision-making data here can be expressed as:

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

[0159] in, represents the fused feature matrix, i.e. the fused data to be decided; I represents the number of data, D represents the fused feature dimension, Represents the weight matrix of the nth mode. Thus, the feature learning and representation of multi-source decision data are realized, and the feature vector of each intelligent agent, that is, the data to be decided, is obtained, which can be expressed as: Among them, v i Represents the feature vector of the i-th multi-source decision data.

[0160] It should be noted that the data foundation is provided for the subsequent graph structure modeling. The data set contains the following: Data features: The feature vector of each data, that is, v i , represents the feature vector of i multi-source decision data. Data label: the label vector of each data, that is Represents multiple evaluation indicators of data, such as greenhouse environmental quality, crop growth status, crop yield, etc. C represents the number of evaluation indicators. Data relationship: The weight of the relationship between each pair of data, that is, Indicates the similarity or correlation between data, such as spatial distance, substrate type, plant variety, etc. Therefore, the decision-making data can be expressed as a triple, namely: (V, Y, W). represents the data feature matrix, represents the data label matrix, It is also necessary to explain that the use of multi-modal and multi-source decision-making data in the greenhouse can improve the quality and integrity of the data to be decided, enhance the data's expressive power and information content, and thus improve the accuracy and reliability of the greenhouse water and fertilizer optimal decision.

[0161] Based on any of the above embodiments, the method provided in the embodiment of the present invention applies the water-fertilizer decision model to the decision optimization problem of greenhouse tomato planting, selects the tomatoes to be planted and adjusts the parameters of the greenhouse according to the value function or strategy function output by the model, so as to improve the yield and quality of tomatoes and reduce the operating cost of the greenhouse. Specifically, the water-fertilizer decision model can be applied to the decision optimization problem of greenhouse tomato planting by using the transfer learning method, and the irrigation time, irrigation amount, nutrient solution concentration, and nutrient ratio are selected according to the value function or strategy function output by the water-fertilizer decision model, so as to improve the yield and quality of tomatoes and reduce the operating cost of the greenhouse.

[0162] In addition, the transfer learning method can also be used to explore the model's migration and generalization capabilities in other agricultural scenarios, such as hydroponics, vertical agriculture, etc., to verify the versatility and scalability of the model. In detail, the following steps can be used to achieve model migration: According to the actual situation of the target domain, such as planting methods, crop types, environmental conditions, etc., determine the number and location of nodes in the target domain, as well as the relationship between nodes, and construct the graph structure of the target domain, that is: in, Represents the graph structure of the target domain, represents the feature matrix of the node, represents the feature matrix of the edge, N′ represents the number of nodes, and D′ represents the dimension of the node feature. Then, according to the multimodal 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, namely (V′, Y′, W′). 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. Furthermore, based on the datasets and graph structures of the source and target domains, domain adaptation methods can be used to align and adapt the features of the source and target domains, reduce the differences between the domains, and improve the performance of the model in the target domain, thereby verifying the universality and scalability of the model.

[0163] Here, the following steps can be used to achieve domain adaptation: A feature extractor method can be used to extract shared feature representations 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 feature, and φ represents the function of the feature extractor, which is in the form of: φ(V) = σ(VWφ+bφ). Among them, σ represents the activation function, such as the ReLU function, Represents the weight matrix and bias vector of the feature extractor. Next, the domain discriminator method can be used to discriminate the domain label from the shared feature matrix of the source domain and the target domain, that is: D = ψ(Z), D' = ψ(Z'). Among them, represents the domain label matrix of the source domain, represents the domain label matrix of the target domain, ψ represents the function of the domain discriminator, and its specific form is: ψ(Z) = Softmax(ZWψ+bψ). Among them, Softmax represents the normalized exponential function, which is used to convert the output of the domain discriminator into a probability distribution. Represents the weight matrix and bias vector of the domain discriminator. Then, the adversarial learning method 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 achieving feature alignment and adaptation of the source domain and the target domain, reducing the differences between the domains, and improving the performance of the model in the target domain, thereby verifying the versatility and scalability of the model. Here, adversarial learning can be achieved by fixing the parameters Wφ and bφ of the feature extractor, updating 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, that is:

[0164]

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

[0166] Next, the parameters Wψ and bψ of the domain discriminator are fixed, and the parameters Wφ and bφ of the feature extractor are updated, so that the feature extractor can extract domain-invariant features and the domain discriminator is difficult to distinguish the features of the source domain and the target domain, that is:

[0167]

[0168] Among them, L f (Wφ, bφ) represents the loss function of the feature extractor, Di2 represents the probability that the i-th feature of the source domain belongs to the target domain, and D′ i1 Indicates 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 stopping conditions such as convergence, stability, etc. are met.

[0169] Then, according to the shared feature matrix of the source domain and the target domain, the graph attention network is used as an approximator of the value function or policy function to output the value function or 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 strategy 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 policy function. 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, the crops to be planted are selected and the agricultural parameters are adjusted to improve the yield and quality of crops and reduce the operating costs of agriculture, that is:

[0173]

[0174] in, represents the action vector of the ith 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 distribution ratio of the i-th node at time t.

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

[0176] Furthermore, the following steps can be used to implement the application and generalization of the model: According to the evaluation indicators and optimization results of the model, the Pareto optimal solution of the model is selected, 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, that is:

[0180] w0=x *

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

[0182] The model is deployed to the decision optimization problem of greenhouse tomato planting, or other agricultural scenarios such as hydroponics, vertical agriculture, etc. According to the value function or policy function output by the model, the crops to be planted and the agricultural parameters to be adjusted can be achieved to improve the yield and quality of crops and reduce the operating costs of agriculture, that is:

[0183]

[0184] in, represents the action vector of the ith 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 distribution ratio of the i-th node at time t.

[0185] It should be noted that through the evaluation indicators and optimization results of the water-fertilizer decision-making model, the application and generalization of the water-fertilizer decision-making model in greenhouse tomato planting and other agricultural scenarios are obtained, which can realize the comprehensive evaluation and optimization of greenhouse environment and crop growth conditions, as well as the migration and generalization to other agricultural scenarios, thereby verifying the versatility and scalability of the model.

[0186] Based on any of the above embodiments, the training method of the water and fertilizer decision 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 acquired. Among them, for environmental data: environmental factors such as temperature, humidity, light, and carbon dioxide in the greenhouse have an important impact on the growth and water and fertilizer requirements of crops. Real-time collection can be performed through sensor equipment 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 actual conditions and needs. It is recommended to collect data every 15 minutes to ensure the timeliness and accuracy of the data.

[0187] For crop data: the types, quantity, growth stage, physiological indicators, yield and other characteristics of crops in the greenhouse have a direct impact on the utilization rate and cost of water and fertilizer. It can be collected regularly through camera equipment installed in the greenhouse (such as smart cameras, etc.), or through manual observation and recording. It is recommended to collect data every other day to ensure the integrity and reliability of the data.

[0188] Regarding water and fertilizer data: irrigation time, irrigation amount, nutrient solution concentration, nutrient ratio and other water and fertilizer management parameters in the greenhouse play a decisive role in the growth of crops and water and fertilizer benefits. It is automatically controlled and recorded by controller equipment installed in the greenhouse (such as intelligent irrigation controller, intelligent fertilizer applicator, etc.), 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, data cleaning is first performed to remove invalid data, abnormal data, duplicate data, missing data, etc., to improve data quality and consistency. You can use Python's pandas library for data cleaning, and use the functions it provides to use dropna, drop_duplicates, fillna, replace, etc. to filter, delete, fill, replace, and other operations on data.

[0190] Then, data fusion is performed. For multimodal data, data fusion is required to effectively fuse different data sources to improve the data's expressiveness and information content. You can use Python's numpy library for data fusion and use the functions it provides to perform operations such as concatenate, stack, hstack, vstack, etc. to concatenate, stack, merge horizontally, merge vertically, etc.

[0191] Furthermore, data standardization is performed. 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. You can use Python's sklearn library for data standardization, and use the functions it provides to use MinMaxScaler, StandardScaler, RobustScaler, etc. to perform operations such as minimum and maximum data scaling, mean variance scaling, and median absolute deviation scaling.

[0192] Finally, the data needs to be stored in the database. For the standardized data, the data needs to be structured and stored to facilitate data reading and use. You can use Python's sqlite3 library to store data, and use the functions it provides to connect, cursor, execute, commit, close, etc. to connect, create, insert, update, close, etc. to the database.

[0193] In the model building stage, the relationships between various areas and crops in the greenhouse are first modeled as a dynamic graph structure based on the 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. You can use Python's PyTorch Geometric library to build a dynamic graph neural network. Use the functions it provides to use Data, DynamicEdgeConv, GNNExplainer, etc. to represent graph data, calculate dynamic edge convolution, and interpret graph neural networks. The optimal performance requirements and configuration of the dynamic graph neural network can be adjusted according to actual conditions and needs. The following model core parameter configuration is recommended:

[0194]

[0195]

[0196] Then, based on the graph attention network as an approximator of the value function or policy function, the multi-head self-attention mechanism is used to achieve multi-angle and multi-scale information fusion and improve the performance and efficiency of the graph attention network. You can use Python's PyTorch library to build the graph attention network, and use the functions it provides to use MultiheadAttention, Linear, Softmax, etc. to perform multi-head self-attention calculations, linear transformations, probability normalization, and other operations. The optimal performance requirements and configuration of the graph attention network can be adjusted according to actual conditions and needs. The following model core parameter configuration is recommended:

[0197]

[0198] In addition, based on multi-agent reinforcement learning, the state, action and reward of each agent are represented as a vector, and the graph attention mechanism is used to calculate the influence of each agent on other agents, as well as the attention weight of each agent, to achieve effective coordination and cooperation among multiple agents. You can use Python's PyMARL library to build multi-agent reinforcement learning. Use the functions it provides to use Runner, Agent, Learner, ReplayBuffer, etc. to run the environment, define agents, update learners, replay experiences, and other operations. The optimal performance requirements and configurations of multi-agent reinforcement learning can be adjusted according to actual conditions and needs. The following model core parameter configurations are recommended:

[0199]

[0200]

[0201] Based on any of the above embodiments, Figure 2 Schematic diagram of the structure of the training device of the water and fertilizer decision model for the greenhouse provided by the present invention. Figure 2 As shown, the device comprises:

[0202] An acquisition unit 210 acquires the decision-making data of the multi-agent, wherein the multi-agent at least includes each area of ​​the greenhouse;

[0203] A feature fusion unit 220, taking the multi-agent as a node, constructs a first graph structure based on the data to be decided, determines a 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 determines the water and fertilizer decision of each agent based on the graph structure fusion feature;

[0204] The training unit 230 optimizes the initial water-fertilizer decision model with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model; the decision reward is determined based on the graph structure fusion feature and the water-fertilizer decision of each intelligent agent.

[0205] The device provided by the embodiment of the present invention uses multiple agents as nodes to construct a first graph structure based on the data to be decided, extracts and fuses the graph structure fusion features based on the graph attention network, and improves the processing ability of the data to be decided. In addition, the initial water and fertilizer decision model is optimized through multi-agent reinforcement learning to obtain more coordinated water and fertilizer decisions between regions, thereby improving the water and fertilizer utilization rate of the greenhouse.

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

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

[0208] Based on the self-attention sublayer and the first graph structure, applying a multi-head self-attention mechanism, determining an attention weight of each attention head and a feature representation of each attention head, and obtaining initial graph structure features of the first graph structure based on the attention weights of each attention head and the feature representation of each attention head;

[0209] Based on the feed-forward sublayer, a nonlinear transformation is performed 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 used for:

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

[0212] Based on the graph attention mechanism and the second graph structure, determining a decision fusion feature of the second graph structure;

[0213] Based on the decision fusion features, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model.

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

[0215] Based on the decision fusion characteristics, determining the coordination optimization strategy of each intelligent agent;

[0216] Based on the coordinated optimization strategy and meta-learning algorithm of each intelligent agent, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model.

[0217] Based on any of the foregoing embodiments, the feature fusion unit is specifically used for:

[0218] Taking the multi-agents as nodes and the relationships between the agents as edges, based on the to-be-decided data of the multi-agents at the previous moment, a first graph structure at the previous moment is constructed;

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

[0220] Based on any of the above embodiments, the acquiring unit is specifically used for:

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

[0222] The source data features of each data source of the multi-source decision data are extracted, and based on the tensor fusion network, the source data features of each data source of the multi-agent are respectively fused to obtain the data to be decided by the multi-agent.

[0223] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the training method of the water and fertilizer decision model of the greenhouse, the method comprising: obtaining the to-be-decided data of the multi-agent, the multi-agent at least including each area of ​​the greenhouse; taking the multi-agent as a node, 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 model, and determining the water and fertilizer decision of each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision model with the goal of maximizing the decision reward 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 decision of each agent.

[0224] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0225] On the other hand, the present invention also provides a computer program product, which includes a computer program, which 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 of the greenhouse provided by the above-mentioned methods, and the method includes: obtaining the data to be decided of multiple agents, and the multiple agents at least include each area of ​​the greenhouse; taking the multiple agents as nodes, constructing a first graph structure based on the data to be decided, 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 model, and determining the water and fertilizer decision of each agent based on the graph structure fusion features; with the goal of maximizing the decision reward of each agent, optimizing the initial water and fertilizer decision model 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 decision of each agent.

[0226] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a training method for a greenhouse water and fertilizer decision model provided by the above methods, the method comprising: obtaining data to be decided of multiple agents, wherein the multiple agents at least include various areas of the greenhouse; taking the multiple agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature; optimizing the initial water and fertilizer decision model with the goal of maximizing the decision reward of each agent to obtain a final water and fertilizer decision model; the decision reward is determined based on the graph structure fusion feature and the water and fertilizer decision of each agent.

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

[0228] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method 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 this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for 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 it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A training method for a greenhouse water and fertilizer decision model, characterized in that: include: Acquire the decision-making data of the multi-agent, wherein the multi-agent includes at least each area of ​​the greenhouse; Taking the multiple agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature; The initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model; The decision reward is determined based on the graph structure fusion features and the water and fertilizer decisions of each intelligent agent.

2. The training method of the water and fertilizer decision model for a greenhouse according to claim 1 is characterized in that: The graph attention network layer includes a self-attention sublayer and a feedforward sublayer; The determining of 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 sublayer and the first graph structure, applying a multi-head self-attention mechanism, determining an attention weight of each attention head and a feature representation of each attention head, and obtaining initial graph structure features of the first graph structure based on the attention weights of each attention head and the feature representation of each attention head; Based on the feed-forward sublayer, a nonlinear transformation is performed on the initial graph structure features to determine the graph structure fusion features of the first graph structure.

3. The training method of the water and fertilizer decision model for a greenhouse according to claim 1 is characterized in that: The initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model, including: Taking the multi-agent as a node, constructing a second graph structure based on the water and fertilizer decisions, decision rewards, and pending decision data of the multi-agent; Based on the graph attention mechanism and the second graph structure, determining a decision fusion feature of the second graph structure; Based on the decision fusion features, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision rewards of each intelligent agent to obtain a final water-fertilizer decision model.

4. The method for training a water and fertilizer decision model for a greenhouse according to claim 3, characterized in that: Based on the decision fusion feature, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model, including: Based on the decision fusion characteristics, determining the coordination optimization strategy of each intelligent agent; Based on the coordinated optimization strategy and meta-learning algorithm of each intelligent agent, the initial water-fertilizer decision model is optimized with the goal of maximizing the decision reward of each intelligent agent to obtain the final water-fertilizer decision model.

5. The method for training a water and fertilizer decision model for a greenhouse according to any one of claims 1 to 4, characterized in that: The method of constructing a first graph structure based on the data to be decided and taking the multiple agents as nodes includes: Taking the multi-agents as nodes and the relationships between the agents as edges, based on the to-be-decided data of the multi-agents at the previous moment, a first graph structure at the previous moment is constructed; Based on the dynamic graph neural network and the first graph structure at the previous moment, the first graph structure is updated, and based on the graph convolutional network and the updated first graph structure, the first graph structure at the current moment is obtained.

6. The method for training a water and fertilizer decision model for a greenhouse according to any one of claims 1 to 4, characterized in that: The step of obtaining the decision-making data of multiple agents includes: Acquire multi-source decision data of the multi-agent; The source data features of each data source of the multi-source decision data are extracted, and based on the tensor fusion network, the source data features of each data source of the multi-agent are respectively fused to obtain the data to be decided by the multi-agent.

7. A training device for a greenhouse water and fertilizer decision model, characterized in that: include: An acquisition unit, which acquires the to-be-decided data of the multi-agent, wherein the multi-agent at least includes each area of ​​the greenhouse; a feature fusion unit, taking the multi-agents as nodes, constructing a first graph structure based on the data to be decided, determining a 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 determining the water and fertilizer decision of each agent based on the graph structure fusion feature; A training unit, which optimizes the initial water-fertilizer decision model with the goal of maximizing the decision reward of each intelligent agent to obtain a final water-fertilizer decision model; The decision reward is determined based on the graph structure fusion features and the water and fertilizer decisions of each intelligent agent.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, a training method for the water and fertilizer decision model for the greenhouse as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the training method of the water and fertilizer decision model for the greenhouse as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the training method of the water and fertilizer decision model for the greenhouse as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Internet of vehicles edge computing task unloading method based on hierarchical reinforcement learning

    CN113568675A

  • 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

  • Heterogeneous graph attention networks for scalable multi-robot scheduling

    US20220226994A1

Cited By

  • Nitrogen fertilizer decision-making method and device for crops, electronic equipment and storage medium

    CN119417135A

  • Crop nitrogen fertilizer management system and method based on multi-agent reinforcement learning

    CN121280165A