The agricultural Internet of Things system, with its large-scale, highly heterogeneous, and dynamic characteristics, brings certain difficulties to the provision of agricultural Internet of Things services. Considering the multiple requests of the agricultural Internet of Things at any random moment, which have the characteristics of multiple sources, multiple types, and uneven tasks, this paper establishes an optimization model for the minimum service cost and proposes a collaborative evolution to intelligent agricultural dynamic services under the Internet of Things environment multiobjective optimization method. First, according to the probability that the allele on the fragment to be vaccinated has appeared in the memory bank, use the detection strategy to judge whether the solution is illegal; secondly, compare the optimal individual with other values appearing on the gene locus, judge whether the optimal gene or fall into the local optimal, and inoculate with probability through simulated annealing; finally, the total service cost and service time were evaluated under the two service provision strategies and compared with the other three intelligent algorithms; the results confirmed the feasibility and effectiveness of the proposed algorithm. At the same time, the simulation results show that the proposed collaborative multiobjective optimization algorithm can achieve better performance.

1. Introduction

The Internet of Things is a technological form with the characteristics of the times. It is a comprehensive technological form that will inevitably arise after network technology, embedded technology, sensor technology, cloud computing technology, and other related technologies that reach a certain level. It is an essential data acquisition, transmission, and processing mode in the era of big data [1]. As a general technical means, the Internet of Things has been extensively studied. However, the combination of the Internet of Things and specific fields requires reoptimization and design of the technology [24].

The agricultural Internet of Things is the core technology of the smart agricultural system. The smart agricultural system is a complex system formed by the fusion of multiple systems [5]. Errors in system design can have disastrous consequences for production. In the process of applying the Internet of Things to the agricultural system, the correctness of the system design directly affects the operation of the system [6, 7]. Regardless of hardware or software, due to the complexity of the system itself and the diversity of the agricultural environment in which it is located, it will be difficult to achieve the perfect system design. How to ensure the correctness of the design of the agricultural Internet of Things system is a problem that must be solved [8]. The agricultural Internet of Things connects the three parties of “man-machine-things” to form a community. It is helpful for agricultural practitioners to manage and control all links, elements, and subsystems in agriculture more scientifically, precisely, and in real time. This greatly improves human’s awareness of the individual nature of agricultural animals and plants, the monitoring and adjustment capabilities of complex agricultural systems, and the ability to respond to emergencies in agricultural production [9]. The agricultural Internet of Things is a systematic project with strong comprehensiveness. It is the only way for agricultural production to achieve green environmental protection, high-quality, high-efficiency, and scientific development. The traditional agricultural model is far from being able to meet the long-term sustainable development needs of agriculture. Currently, research on the Internet of Things in agriculture has been widely implemented worldwide. But overall, the application is still in the experimental demonstration stage [1012].

The agricultural Internet of Things service is an emerging industry and an inevitable trend of intelligent agricultural production in the future [13]. From the perception of the Internet of Things to decision-making and then to control, it is a necessary link to realize the integrated intelligent control of the autonomous service of the Internet of Things. The perception of the Internet of Things has problems such as information uncertainty and high redundancy. It is necessary to study data processing methods such as data cleaning, data compression, and data fusion to realize the efficient perception of Internet of Things information [1416]. Sensor perception is like the human sensory system, actively discovering or passively receiving external stimuli. They can extract details from the external environment even faster than human observers.

Since artificial intelligence was proposed in 1956, it has been the research direction of scholars and computational intelligence is an important branch of artificial intelligence research. Computational intelligence is based on the perspective of biological evolution to recognize and simulate intelligence. It is based on data and solves problems through training to establish connections [1719]. Natural biological systems have evolved many mechanisms in the process of continuous evolution and have strong adaptability to complex and dynamic changes in the external environment. The different components or organizations of the biological system can function autonomously and collaboratively under limited rules to realize the complex behaviors and functions of the entire system. At present, many scholars try to summarize and abstract the action rules and regulatory control mechanisms of biological systems into mathematical forms or action rules. It provides a theoretical basis and a new source of inspiration for designing efficient and robust complex network architectures, control systems, learning systems, and optimization algorithms [20].

The application scenarios of the agricultural Internet of Things are mainly concentrated in the field, facility gardening, and livestock and poultry breeding. Since the agricultural Internet of Things is based on a specific application scenario of agriculture, it should be closely integrated with agriculture-related scenarios in its design and implementation. In the realization of the system, the universal characteristics of the Internet of Things should be considered and the characteristics of the combination with agricultural production conditions should be considered. The data collected by these perception layers are transmitted through the Internet of Things. In the application management layer, the data is analyzed and decided. Participate in the automatic control and adjustment of the production environment of agricultural products to ensure that agricultural products have a suitable production environment and obtain the best production conditions.

Reference [2123] discussed the issue of resource service provision on cloud platforms. Efficient resource service provision strategy can guarantee satisfactory cloud computing services to end users. Reference [24] introduced the Nash equilibrium to deal with resource transaction activities between cloud service providers and used game theory in the process of providing Internet of Things services. Reference [25] uses resource sharing among cloud service providers for customs clearance to achieve efficient use of limited resources and improve service quality. In the cloud model, on-demand computing resources (such as networks, storage, and servers) can be allocated from a shared resource pool with minimal management. Infrastructure as a service (IaaS) is one of the most common cloud service models. In the IaaS model, services are deployed as virtual machines in the cloud computing infrastructure, with the goal of extreme use of resources [26]. In contrast, in the resource and service scheduling model widely studied in cloud computing, users are charged according to their resource usage and required service quality specifications, while the focus of the Internet of Things service model is different from the cloud model. Although cloud computing is important in Internet of Things analysis and data storage, the Internet of Things does not necessarily include the cloud. Nevertheless, the service scenarios are different but the ideas provided by these services can open up ideas for the provision of Internet of Things services.

Reference [27] proposed a service provision platform for the Internet of Things based on a multilevel and multidimensional model. It can access large heterogeneous resources and expose their functions as a lightweight service. In a distributed Internet of Things environment, it provides a unified message space to promote the on-demand dissemination and sharing of sensor information. The platform supports application sharing and reuse of resources and provides an infrastructure for Internet of Things application models. Reference [28] uses the neuroendocrine system’s comprehensive regulation mechanism of blood glucose concentration to realize the monitoring of randomly generated service requests by the Internet of Things. However, the service delivery strategy has not been studied in depth. Reference [29] proposed a framework model for service submission based on the Internet of Things. Based on this model, abstract and dynamic collaboration methods are used to realize the resource sharing of the Internet of Things and the service dynamic composition technology is adopted to realize the rapid submission of complex services. However, it does not consider the algorithm’s resource consumption and optimization of the service capability itself. Reference [30] adopts a method of network perception, using genetic algorithm to realize adaptive service selection and provision. Reference [31] adopts configurable event-driven combination and adaptive service provision, which is divided into three core services: coordination service, context service, and event service.

At this stage, the agricultural Internet of Things is in the early stage of construction, commercial terminals have not yet been widely popularized, the business volume is small, and there is a lack of optimization experience to learn from. It is urgent to carry out targeted research on network and business collaborative optimization. The main research contents of this paper are as follows: (1)Based on the probability that the alleles on the fragments to be vaccinated have appeared in the memory bank, the detection strategy is used to judge whether the solution is illegal. It can effectively improve the shortcomings of premature convergence and poor local search ability(2)Compare the optimal individual with other values that have appeared on the gene locus, and judge whether the optimal gene or the local optimal. And inoculate with probability through simulated annealing to improve the robustness of the algorithm(3)Evaluate the total service cost and total service time under the two service provision strategies. The experimental results verify the feasibility and effectiveness of the proposed algorithm

3. Agricultural Internet of Things Service Architecture and Optimization Model

3.1. Agricultural Internet of Things Service Architecture

There are two main occasions for agriculture: facility agriculture and field. In facility agriculture, there are usually more greenhouse environments. The research in this paper is aimed at coevolutionary multiobjective optimizing the methods for intelligent agricultural dynamic services in the Internet of Things environment. Various sensors are installed to monitor the growth of various vegetables and fruits. The service architecture of the agricultural Internet of Things is shown in Figure 1.

Examples of sensors include temperature sensors, humidity sensors, soil moisture sensors, nutrition measurement sensors, and carbon dioxide sensors, used to measure physical parameters such as temperature, relative humidity, soil water content, soil nutrients, and carbon dioxide concentration. These monitored data are sent to the computer platform (network layer) through aggregation and then analyzed and processed. Data that meets a certain condition is considered a service request in this chapter. When the sink node integrates all kinds of data from sensors, several service requests will be generated. All the request tasks are scheduled and assigned to different service devices by the service computing platform in a global optimization way. Here, we consider them as a service request queue. The multiservice window system of agricultural Internet of Things can be modeled as the queuing model. This paper adopts the parallel batch processing mode for requests in unit time. In this agricultural Internet of Things service scenario, some agricultural equipment, such as irrigation machines, fertilizer spreaders, and spraying machines, is a service provider. The agricultural Internet of Things service architecture has three layers: intelligent perception layer, network layer, and equipment control layer. Suppose that there are only two types of equipment that provide services, irrigation machines and fertilizer spreaders. According to the degree of water shortage or undernutrition, the priority of requests is defined into two categories: urgent and general. If this is an urgent task, it will have a higher priority.

The most basic components of an Internet of Things temperature sensing service should be completed by related functional components such as sensors, Internet of Things data transmission layers, and web services in the Internet of Things system. At the data transmission layer of the Internet of Things, it is possible to complete the encapsulation of the Internet of Things functions required for temperature sensing services, such as combining the relative position information of the humidity sensor node with the temperature value to form a new data structure and other operations. The release of temperature sensing service can be done by using the web service in the system, and the web service can provide functions such as retrieval and browsing of related information.

3.2. Optimization Model

The biological immune system is a kind of control system with strong robustness and adaptive ability in complex disturbance and uncertain environment. The endocrine system and the immune system have a close two-way regulatory connection. Endocrine hormones can enhance or weaken the immune function through hormone receptors on immune cells. The immune system affects the endocrine system through cytokines, and the same cytokine has specificity in the regulation of different hormone secretion activities.

There is a general rule of hormone secretion by hormone glands. The rise and fall of hormone regulation follows the Hill function, as shown in formulas (1) and (2), respectively. where is the independent variable, is a threshold value greater than 0, is the Hill coefficient, and its value is greater than 1. and jointly control the slope.

Using the Hill function, the secretion of hormone is expressed in the following form: where hormone controls hormone , is the base value of hormone , and represents a constant coefficient.

AIE is an improved adaptive immune algorithm based on the endocrine regulation mechanism. This algorithm can make individuals have good diversity and effectively overcome the problems of immature convergence and slow evolution. This is mainly due to the adaptive crossover and mutation probability factors designed in this paper. Follow the law of Hill function to regulate the rise and fall of endocrine hormone secretion regulation.

4. Adaptive Immune Algorithm Based on Endocrine Regulation

4.1. The Mapping Relationship between the Agricultural Internet of Things System and the Immune System

Immunity is a part of species evolution, which enables the body to distinguish between the antigen and the body in the body and produce antibodies to inhibit the invasion of the antigen. After the action is over, the antibodies will be balanced to keep the environment in the body stable. Incidentally, immune cells are produced to produce rapid and effective responses to similar antigens in the future. The process by which organisms produce antibodies to foreign antigens through biochemical action to eliminate the invasion is called immune response. During the first immune response, the information is retained by memory cells after the body clears the antigen. When the antibody carrying this kind of information invades again, it will activate the memory cells and quickly produce equivalent antibodies to eliminate the effect through cell differentiation. This phenomenon has reference significance for optimization problems.

4.2. Adaptive Immune Algorithm Flow

The adaptive thought of genetic algorithm refers to an algorithm that dynamically adjusts the control parameters in the algorithm according to the changes in the fitness of the population during the operation of the genetic algorithm. Its main purpose is to increase the diversity of the population at the right time to avoid the situation where the algorithm falls into a local optimal solution. As far as genetic algorithm is concerned, it is mainly used to adjust the crossover probability and mutation probability.

This paper mainly uses information entropy to characterize the similarity of the population, so as to adaptively adjust the crossover probability and mutation probability. The specific description of the algorithm is as follows: (1)Population average information entropywhere is the information entropy of the -th gene: where is the probability that the -th symbol appears on the locus (2)Population similaritywhere characterizes the overall similarity of the entire population (3)Adaptive strategy

When the fitness of the population tends to be consistent or tends to the local optimum, increase and , and decrease and when the fitness is relatively scattered. and are automatically adjusted according to the following formula: (4)Adaptive extraction of vaccines

The adaptive extraction of vaccines specifically includes two processes: extraction of vaccines and vaccination. Assuming that the antibodies with the best fitness in each generation preserved population, then antibodies were retained in the most recent generation to form the optimal antibody group. Each locus of each antibody has , where symbols for selection. The probability that the -th allele is is

Select the antibody to be vaccinated from the parent population, and select one or more gene fragments according to the roulette method. Generate new immune individuals by replacing gene code values to form a better population. The gene fragment selection method is as follows: from the above extraction of the vaccine, we know that the vaccine is , so

This paper proposes an adaptive immune genetic algorithm with endocrine regulation (AIGE). The information entropy is calculated to evaluate the similarity of the population, so as to adaptively adjust the crossover probability and mutation probability. The algorithm adopts the method of dynamically extracting vaccines, which avoids the shortcoming of a slower convergence rate due to the reduced effectiveness of static vaccines in the evolution process. The flow of the improved adaptive immune genetic algorithm is shown in Figure 2.

4.3. Improved Design of the Immune Genetic Algorithm

The simple immune genetic algorithm simulates the antibody memory antigen information bionic from the immune system of the organism into a vaccine operator composed of recording tape solving problem feature information, prior knowledge, and heuristic rules. By extracting vaccines, the original random search of the genetic algorithm is improved to some extent. This improvement has demonstrated excellent search results in many combination optimization problems. But with the continuous optimization of intelligent algorithms, immune genetic algorithm, as an improved algorithm of genetic algorithm, still inherits randomness. The cross-based global search weakens the local convergence, and the Pareto solution is often not obtained when solving large-scale problems with complex space. Because vaccination and immune selection tend to converge in one direction, it is not conducive to maintaining diversity of the population.

The survival of the fittest in the evolution process is judged based on the affinity set by the objective function. It is impossible to absolutely judge the pros and cons of individual gene segments, leading to missed opportunities to find the optimal solution earlier. The setting of parameters needs to be considered for various algorithms. Setting fixed control parameters for operations such as crossover and mutation before searching is not suitable for the updated status of the new population. The extraction of vaccines is also difficult. Insufficient and inaccurate prior knowledge will reduce the overall effectiveness of the algorithm. The implicit information of a certain vaccination may lead to iterative guidance, causing the search to go in a certain direction and stall. In addition, the preextracted vaccine sometimes cannot obtain prior knowledge from the question to be asked or it is difficult to discover characteristic information. Taking too long to extract information will lead to the time inefficiency of the algorithm. Aiming at these deficiencies of the basic immune genetic algorithm, this paper proposes to improve the algorithm design in the following aspects: adopting a two-layer coding based on machine selection and process sequencing to avoid illegal solutions.

Evaluation the antibodies after population initialization. Using concentration inhibition, the concentration of antibody in the population refers to the proportion of the antibody with its similar antibodies in the population, namely,

In population renewal, the concentration of antibodies with high affinity is increased and it will be inhibited when it reaches a certain value. On the contrary, the production and selection probability of antibodies with low concentration should be increased. Therefore, when judging whether the diversity meets the requirements, different similarity thresholds should be set according to the size of the group . But so far, the selection of still lacks a strong theoretical basis. Refer to the fitness threshold of the critical path to modify it so that it quickly converges and obtains the global optimal solution.

Refer to medical treatment to prevent allergic reaction, immune deficiency, autoimmunity, virus infection and other immune abnormalities. For vaccination, the “skin test” and other prevaccination tests are carried out to avoid overimmunity and underimmunity. The allele selection of the detection strategy is used to judge. The specific method is to compare the corresponding loci of the new and old optimal individuals. If the probability of occurrence is small, strictly control it and decide whether to discard it after judging whether the solution is illegal. If the similarity of a certain gene locus to be vaccinated is high, it is also judged whether it is the best gene or falls into the local optimum. If the gene locus has other values that can constitute an individual with higher fitness, simulated annealing is used to inoculate with probability to avoid local optimality. The method is as follows: when the temperature is , the -th allele to be vaccinated is and the difference between the two solutions is . If , inoculate; if , inoculate with probability where , is the cooling times, and Boltzmann constant can be set as a positive number close to 1, such as 0.95.

4.4. Convergence Analysis

Let the population size of the immune genetic algorithm be . Let the length of individual chromosomes be . Genes are coded in the system, and the crossover and mutation probabilities are and , respectively. The probability of a certain gene mutation in another situation is . The state transition equation of immune genetic algorithm is

The state transition from to forms a Markov chain. By analogy, to are still a Markov chain. Let be a point in the state space ; then, the coordinates of the point are individuals in the search space . The number of states is denoted by . A certain state in is denoted as , . The ownership of the subset in the search space is represented by . Use to represent the state of the random variable in the generation.

Let be the fitness function on . Suppose that the optimal state set . For any population distribution after multiple iterations, the probability convergence is expressed as

Research has proved that the immune genetic algorithm is probabilistically convergent, and the genetic algorithm alone cannot guarantee convergence to the global optimal solution. Vaccines that improve antibody fitness above the average level will spread exponentially and vice versa.

5. Experiment and Result Analysis

5.1. Parameter Settings

This section designates an agricultural Internet of Things area for experimentation. The perception data from the sensor needs to be analyzed and processed according to the various parameters of good plant growth. After the service request is issued, the service computing platform calculates and selects the optimal service device based on the request type and workload and then turns on and controls the device switch.

The parameter value setting is shown in Table 1. In Table 2, indicates the average number of requests that reach the system per unit time. In this section, five batches of the request tasks are tested under each value. The number of requests in each batch is based on random numbers generated under the current value. The number of sensor nodes is set to 200 to ensure a sufficient number of requests in different experimental environments. The number of device nodes is set to 100. Considering the actual scenario, the greenhouse generally uses nearby irrigation machines or other equipment. If the distance between the request and the service is greater than a certain set threshold, the obtained service plan is meaningless. Therefore, the optimal service scheduling schemes given in this article are all based on the scope of implementation of the equipment.

Table 3 gives the parameter values when various algorithms are running. The termination conditions of each algorithm are set to 100 epochs.

5.2. Comparison of Simulation Results

In order to fully verify the performance advantages of the proposed algorithm for improving AIGE, this paper chooses particle swarm optimization (PSO), genetic algorithm (GA), immune algorithm (IA), and the algorithm of this paper to compare experiments.

Figure 3 shows the total service cost of different request arrival rates under the single-service strategy. In Figures 3(a)3(d), it can be observed that the adaptive immune algorithm proposed in this paper has the best performance under four different request arrival rates. When =5 and =10, the proposed improved AIE algorithm is better than the PSO algorithm, which is roughly consistent with the performance of the GA algorithm. The results also show that as the value of increases, the proposed improved AIE algorithm gradually shows its superiority over GA and PSO algorithms. This shows that the proposed improved AIGE algorithm has the potential to solve high-dimensional problems.

Figure 4 shows the total service cost of different request arrival rates under the collaborative service strategy. As shown in the figure, the algorithm proposed in this paper has the lowest service cost ratio and its performance ranks first. It can be seen in Figure 4(a) that when =10, the total cost value obtained by improving the AIE algorithm and GA is very close. It can be seen in Figure 4(d) that the difference between the improved AIGE algorithm and the results obtained by GA in processing the fourth and fifth batches of requests is relatively small. This is because their ability to explore the solution space is close when requesting these two large quantities under the collaborative service strategy. When the number of requests in the first three batches is relatively small, the improved AIE algorithm is slightly better than the GA algorithm. In Figures 4(b) and 4(c), it can be observed that the improved AIGE algorithm has the best performance. When =30 and =40, the results shown in Figures 4(c) and 4(d) reveal the superiority of the improved AIGE algorithm under the collaborative service strategy.

It can be seen from the above results that the total cost curve conforms to normal fluctuations, which depends on the change in the number of requests. For the same value, the change directions of the curves of the four algorithms are the same. The service system can choose the service mode freely according to the specific situation. For example, when multiple requests are in the peak period or the task is urgent, the system can choose the cooperative service strategy to reduce the service time; otherwise, it can choose the single-service strategy.

It can be seen in Figure 5(a) that for four different values, the curves of the GA algorithm and the IA algorithm remain relatively smooth. As the value of increases, the curve of the improved AIGE algorithm shows a slow upward trend, while the PSO shows a sharp upward trend. This illustrates that for PSO, the calculation time is very sensitive to the dimensionality of the problem. It can be seen in Figure 5(b) that each algorithm under the collaborative service strategy takes more time than under the single-service strategy. Because the collaboration strategy requires more service providers to participate in the task. The increase in computing workload is normal. Although the improved AIGE algorithm proposed in this paper consumes more computing time than the IA algorithm and the GA algorithm, it obtains a lower service cost.

6. Conclusion

This article systematically introduces and analyzes the service selection and optimization methods of the agricultural Internet of Things. Collaborative optimization of Agricultural Internet of things service resources has been deeply studied. A single-service strategy and a collaborative service strategy optimization model are constructed. A coevolutionary multiobjective optimization method for intelligent agricultural dynamic services under the Internet of Things environment is proposed. According to the probability that the allele on the fragment to be vaccinated has appeared in the memory bank, the detection strategy is used to judge whether the solution is illegal. By comparing other values that have appeared on the gene locus, the optimal individual can be formed to judge whether the optimal gene or the local optimality. And through simulated annealing to inoculate with probability, the resource allocation and optimization for the dynamic service of the agricultural Internet of Things are solved. Evaluate the total service cost and total service time under the two service provision strategies. The results confirmed the superiority of the proposed improved AIGE algorithm. This article proposes a service cost and service time minimization model from the perspective of service providers. In the future, the cost of the service request party will be considered to make the Internet of Things service model more perfect.

Data Availability

The data included in this paper are available without any restriction.

Conflicts of Interest

The authors declare that there is no conflict of interest regarding the publication of this paper.

Authors’ Contributions

The main idea of this paper is proposed by Haihong Liang. The algorithm design and experimental environment construction are completed by Haihong Liang. The experimental verification was completed by Haihong Liang. The writing of the article is completed by Haihong Liang. And the writing guidance, English polish, and funding of the project are completed by Haihong Liang.


This work was supported by the Zhejiang Philosophy and Social Science Foundation Project (no. 15NDJC290YBM) and the Fund Project of the Science and Technology Department of Zhejiang Province (no. 2015C35040).