# Optimization Strategy of IoT Sensor Configuration Based on Genetic Algorithm-Neural Network

Authors: Yuanyuan Yang
Journal: Journal of Sensors
 (2021)

---

## Abstract

This article carries out the overall design framework of the IoT sensor data processing platform and analyzes the advantages of using the integrated construction platform. The platform is divided into two parts, a web management platform and a data communication system, and interacts with the database by integrating the business layers of the two into one. The web management platform provides configurable communication protocol customization services, equipment information, personal information, announcement information management services, and data collection information monitoring and analysis services. The collected data is analyzed by the sensor data communication service system and then provided to the web management platform for query and call. This paper discusses the theoretical basis of the combination of genetic algorithm and neural network and proposes the necessity of improving genetic algorithm. The improved level involves chromosome coding methods, fitness function selection, and genetic manipulation. We propose an improved genetic algorithm and use an improved genetic algorithm (IGA) to optimize the neural network structure. The finite element method is adopted, the finite element model is established, and the shock piezoelectric response is numerically simulated. The genetic neural network method is used to simulate the collision damage location detection problem. The piezoelectric sensor is optimized, and the optimal sensor configuration corresponding to its initial layout is obtained, which provides guidance for the optimal configuration of the actual piezoelectric sensor.


---

## Body

## 1. Introduction

The Internet of Things is an emerging thing. By combining various wired and wireless networks with the Internet, information about objects can be transmitted in real time and accurately [1]. The information data collected by the sensors at the perception level of the Internet of Things needs to be transmitted through the network. Due to the huge amount of data, a huge amount of information is formed. In the process of transmission, in order to ensure the accuracy and real time of the data, it must be adapted to various differences [2]. The Internet of Things is the integration of all things in the world, and of course, it is also the integration of all networks. Among the underlying perception layers of the Internet of Things, the most important and most widely used one is the wireless sensor network. Different wireless sensor networks have different requirements for sensor nodes. The development of wireless sensors provides a material foundation for the progress of the Internet of Things. Wireless sensor networks are now widely used in smart industries, smart communities, smart furniture, smart transportation, and smart medical care. The wireless sensor network has a strong application type, and different applications use different sensor nodes, network protocols, and security architectures, which have strong particularities [3].The Internet of Things is a ubiquitous network built on the Internet. Through the organic integration of existing networks, a unified whole is formed. The Internet of Things has been developed gradually with the progress of various networks, especially the improvement of the technology of the original wireless sensor. The wireless sensor network is the most important part of the Internet of Things [4]. The wireless sensor network is an important part of the perception layer of the Internet of Things. With the development of science and technology, the functions of wireless sensor nodes are more diverse. Different perception nodes can perceive all kinds of information that people need and send them to the final application in a timely and stable manner. It is a deep-level expansion of the original network and an important material basis for the development of the Internet of Things. The Internet of Things is an extension of the existing network. In the process of merging the existing network, a large number of new problems will arise, such as the four points mentioned above. These problems will directly affect the security and stability of the network [5]. Only protocols that meet the requirements of the Internet of Things and ensure the safety and reliability of wireless sensor networks can solve these problems [6].This article analyzes the requirements of the IoT sensor data processing platform, puts forward the overall design ideas and framework of the platform on this basis, and divides the platform into a web management platform that provides web services and sensor data that provides data services and communication services. This article gives the necessity and feasibility of combining neural network and genetic algorithm. We use an improved genetic algorithm (IGA) to optimize the neural network, so that IGA can optimize both the structure of the network and the weight of the network. Specifically, the technical contributions of this article can be summarized as follows:First, the approximation of the nonlinear function is realized on the MATLAB platform, which proves that the method enhances the performance of the network and improves the generalization ability. In this paper, the structure of the wing box specimen is analyzed, using the finite element method, the finite element model of the wing box specimen is established, and the excitation voltage response is numerically simulated.Second, based on the problem of detecting the impact damage position, we optimize the piezoelectric sensor of the wing box section specimen and obtain the optimal configuration of the sensor in the initial layout mode. Compared with the case of selecting 42 sensors in the initial sensor layout, now only 24 sensors are needed, which reduces the cost. Although the damage detection error has been improved, the costs and benefits are integrated.Third, the simulation results show that for the initial deployment mode of more sensors, the genetic neural network method can effectively reduce the number of more sensors, thereby reducing costs. The simulation results can provide certain guidance for the optimal configuration of the actual piezoelectric sensor of the structural specimen.


## 2. Related Work

Related scholars have designed a model theorem for genetic algorithms [7]. In this model theorem, there is a prominent problem. It is difficult to calculate and analyze model fitness. Zhou et al. [8] developed an analysis tool using wash function and model conversion. In this way, in view of the above problems, the calculation of model fitness can be solved, but there are also some shortcomings. For example, the genetic process of genetic algorithm cannot be directly explained, and the accuracy of model fitness is not high. Regarding the code length, experts have done some research on this [9]. Akbas et al. [10] proved that if binary coding is used, the code length is related to the optimal number of individuals. Regarding the population size, the size of the population is difficult to calculate. To find a suitable population size, you need to start from the actual problem. The process of solving the problem is different, and the required population size is also different. There are two more important parameters in genetic operators (crossover probability Pc and mutation probability Pm). So far, the selection and setting of Pc and Pm have not been guided by a whole set of theories. The crossover probability will be related to the genetic algorithm. The probability of mutation will be related to the diversity of individuals in the population. In many cases, the selection of Pc and Pm parameters is statically set according to the problem to be solved. Static setting will lead to blindness. If it can be set dynamically during the evolution process, this problem will be avoided, and it will also speed up the search for the best [11]. This article is to make the crossover probability and mutation probability dynamically adjust with the evolution process. When the individual’s fitness is high, the crossover probability will become smaller; when the individual’s fitness is low, the mutation probability will change. Regarding the number of evolutions, it is currently in the research stage [12]. The determination of the number of evolutions is based on personal experience and multiple experiments.Neural networks are based on the distributed storage, parallel processing, and adaptive learning of the biological nervous system, which enable the neural network to obtain preliminary intelligence. The expert system is similar to intelligence. The expert system stores relevant professional knowledge. When a problem is encountered, there is corresponding logical reasoning to solve the problem [13]. However, when the situation encountered is not stored in the expert system, the entire system will be paralyzed. The neural network has fault tolerance and self-learning ability. When encountering incomplete information or abnormal situations, the system will give a reasonable judgment and decision on complex problems based on the knowledge and experience learned in the past. Artificial intelligence is the organic combination of expert system and neural network, using the advantages of the two rules [14]. The field of artificial intelligence applications has been extensive, for example, password deciphering, predictive valuation, market analysis, system diagnosis, logical reasoning, and fuzzy judgment.The HEED protocol proposed by related scholars aims at the deficiencies of the LEACH protocol and proposes an improved clustering algorithm [15–17]. The algorithm selects cluster heads through two primary and secondary parameters. The primary parameter is the remaining energy of the node, and the secondary parameter is the proximity of the node or the density of the node. The cluster head selection of this algorithm is an iterative process [8, 18, 19]. When a candidate cluster head is found to be better than itself, it will join the cluster. The convergence speed of the HEED algorithm is faster, and the energy and location of the node are fully considered, which balances the energy consumption of the node and reduces the occurrence of conflicts. Relevant scholars put forward the concept of virtual clusters [20–22]. The synchronization of time between virtual clusters must be ensured, and each node will sleep and work periodically according to the schedule. This method solves the problem of channel conflicts, but due to the communication problems between the network and the nodes, how to achieve time synchronization is really difficult to solve [23, 24]. This algorithm is more difficult to implement. Because time synchronization requires the cluster head node to continuously broadcast, it takes up a large number of channels [25].A large number of facts show that the selection process is very important, and improper selection will lose the genes of excellent individuals, which will affect the convergence effect of genetic algorithms [26, 27]. There are many ways to choose, about 20 kinds, for example, ratio selection, equally divided selection, and essence selection. The key role in the genetic algorithm is the crossover operator. Selection operator and crossover operator are the two operations that best embody genetic algorithms. At the same time, nature’s “natural selection by nature, survival of the fittest” is also realized through these two operations. There are not many theories about crossover, and they are immature, but there are about 20 kinds of crossover technologies. Selection and crossover cannot solve all the problems in genetic algorithms. The mutation operator changes the nature of an individual in order to avoid “premature” convergence, that is, the change of an individual’s genetic information. Different crossover operators are used to improve the convergence efficiency and global search ability of genetic algorithms, so as to obtain better genetic effects. The application of different mutation operators is to avoid the occurrence of “premature” phenomenon. In the process of genetic algorithm optimization, it is difficult to have both convergence efficiency and global search capability [28, 29].


## 3. IoT Sensor Data Processing Platform Architecture

### 3.1. Overall Analysis of the Platform

The IoT sensor data processing platform designed in this paper needs to build a website as a client terminal management platform and a data communication system to complete various data communication services. An internal message loop is required between the two systems so that the status of the front-end equipment of the Internet of Things can be quickly reflected on the page through the platform, and at the same time, the client can send page requests to the front-end equipment through the platform. In terms of specific function realization, the basic function of the Internet of Things is to provide ubiquitous connections and services. Therefore, the basic functions provided by the platform should include providing support for the connection of users and devices, providing support for the online setting and management of device information, providing support for processing sensor data collected by the device, and providing support for user visualized operation communication data.The network transmission format of sensor data collected by the device is generally divided into two types: text transmission format and binary transmission format. The text transmission format is more readable, but because it contains redundant items such as tags, the transmission efficiency is relatively low compared to the binary transmission format, and it also takes up a relatively large volume when stored; the binary format is composed of simple bytes. The information volume is small and the transmission efficiency is high, but the readability and the convenience of encoding and decoding are relatively poor.The text transmission format and the binary transmission format have their own advantages and disadvantages in the transmission process, but the existing IoT platforms generally choose the text transmission format and a single transmission protocol for communication, which is not conducive to the expansion of the platform and has certain limitations. Therefore, in order to meet diversified transmission requirements, the IoT sensor data processing platform designed in this article needs to support both binary transmission format and text transmission format, so that users can choose the most suitable transmission according to the requirements of data transmission and the conditions of hardware equipment.


### 3.2. The Overall Function and Framework Design of the Platform

We design the functions and framework of the IoT sensor data processing platform, as shown in Figure1. The overall structure of IoT applications includes three parts: IoT device terminals, servers, and client terminals. The IoT sensor data processing platform designed in this article corresponds to the server part, providing support for the communication between IoT device terminals and client terminals. Therefore, this article divides the IoT sensor data processing platform into three parts: web services, communication services, and data services. It provides analysis, processing, and monitoring functions for the collected sensor data.Figure 1
The overall structure of IoT applications.The existing Internet of Things application platforms on the market generally provide user information management services, including user registration, login, information modification, and other functions. This article designs the platform functions on this basis.The platform’s web service provides users with a visual and friendly operation interface. After logging in to the system, they can classify and manage personal information, device information, and sensor data information and can also perform simple message publishing to provide communication services within the platform. On this basis, the platform provides users with customized pages of communication protocols. Users can freely customize within the framework of communication protocols according to the needs of devices or applications. The customized communication protocols are output in the form of XML documents.


### 3.3. The Overall Technical Architecture of the Platform

The IoT sensor data platform designed in this paper uses simple and efficient Maven for project management and development. SSH2 and Easyui plug-ins are jointly responsible for the construction of the web management platform, and the MINA framework is responsible for the construction of data communication service system modules. At the same time, this article uses the XML language with good scalability to construct the communication protocol for data transmission and uses XStream technology to analyze and operate according to the communication protocol.As the core framework, SSH and MINA frameworks provide a guarantee for the construction of the entire platform. The SSH framework is composed of the Spring framework, the Struts framework, and the Hibernate framework and is a relatively classic web application construction framework model. Struts2 is the final implementation framework of the MVC model, and its hierarchical structure makes it necessary to focus only on the implementation of the specific business logic layer when building the platform. At the same time, only a simple configuration in the Struts configuration file can make corresponding countermeasures to various abnormal conditions of the platform. The Hibernate framework is nonintrusive when applied. At the same time, the framework provides an object-oriented HQL language, which simplifies the workload of connecting to the database. The Spring framework provides various management services for the entire web platform and performs persistence operations through Spring-Dao to complete operations such as adding, deleting, modifying, and checking data.The MINA server framework is a Socket communication framework for building data communication services, which has good scalability. At the same time, MINA introduces an asynchronous nonblocking mechanism and a multithreaded mechanism in the IO operation, so that the system can communicate with a large number of clients at the same time, which improves the performance of the system. The filtering layer in the MINA framework can achieve hierarchical processing of the underlying communication and business logic. Therefore, the use of MINA to build a data communication service system does not consider the complexity of the network layer, making the development process simple and straightforward.By adding support for Spring in MINA, at runtime, the system will inject the relationship between the programs into the corresponding components according to the content of the configuration file, so as to achieve loose coupling between classes. Therefore, at the technical level, this article combines MINA and SSH to jointly build an IoT sensor data processing platform, integrates the business logic layer of the web management platform and the data communication service system through Spring, and realizes the efficient operation of the entire platform. Figure2 shows the technical architecture diagram of the Internet of Things service platform. When the platform is started through the Tomcat server, the data communication service based on MINA and the web service based on SSH2 run at the same time and, finally, realize the communication service between the device terminal and the client terminal.Figure 2
Technical architecture of IoT sensor data processing platform.


## 3.1. Overall Analysis of the Platform

The IoT sensor data processing platform designed in this paper needs to build a website as a client terminal management platform and a data communication system to complete various data communication services. An internal message loop is required between the two systems so that the status of the front-end equipment of the Internet of Things can be quickly reflected on the page through the platform, and at the same time, the client can send page requests to the front-end equipment through the platform. In terms of specific function realization, the basic function of the Internet of Things is to provide ubiquitous connections and services. Therefore, the basic functions provided by the platform should include providing support for the connection of users and devices, providing support for the online setting and management of device information, providing support for processing sensor data collected by the device, and providing support for user visualized operation communication data.The network transmission format of sensor data collected by the device is generally divided into two types: text transmission format and binary transmission format. The text transmission format is more readable, but because it contains redundant items such as tags, the transmission efficiency is relatively low compared to the binary transmission format, and it also takes up a relatively large volume when stored; the binary format is composed of simple bytes. The information volume is small and the transmission efficiency is high, but the readability and the convenience of encoding and decoding are relatively poor.The text transmission format and the binary transmission format have their own advantages and disadvantages in the transmission process, but the existing IoT platforms generally choose the text transmission format and a single transmission protocol for communication, which is not conducive to the expansion of the platform and has certain limitations. Therefore, in order to meet diversified transmission requirements, the IoT sensor data processing platform designed in this article needs to support both binary transmission format and text transmission format, so that users can choose the most suitable transmission according to the requirements of data transmission and the conditions of hardware equipment.


## 3.2. The Overall Function and Framework Design of the Platform

We design the functions and framework of the IoT sensor data processing platform, as shown in Figure1. The overall structure of IoT applications includes three parts: IoT device terminals, servers, and client terminals. The IoT sensor data processing platform designed in this article corresponds to the server part, providing support for the communication between IoT device terminals and client terminals. Therefore, this article divides the IoT sensor data processing platform into three parts: web services, communication services, and data services. It provides analysis, processing, and monitoring functions for the collected sensor data.Figure 1
The overall structure of IoT applications.The existing Internet of Things application platforms on the market generally provide user information management services, including user registration, login, information modification, and other functions. This article designs the platform functions on this basis.The platform’s web service provides users with a visual and friendly operation interface. After logging in to the system, they can classify and manage personal information, device information, and sensor data information and can also perform simple message publishing to provide communication services within the platform. On this basis, the platform provides users with customized pages of communication protocols. Users can freely customize within the framework of communication protocols according to the needs of devices or applications. The customized communication protocols are output in the form of XML documents.


## 3.3. The Overall Technical Architecture of the Platform

The IoT sensor data platform designed in this paper uses simple and efficient Maven for project management and development. SSH2 and Easyui plug-ins are jointly responsible for the construction of the web management platform, and the MINA framework is responsible for the construction of data communication service system modules. At the same time, this article uses the XML language with good scalability to construct the communication protocol for data transmission and uses XStream technology to analyze and operate according to the communication protocol.As the core framework, SSH and MINA frameworks provide a guarantee for the construction of the entire platform. The SSH framework is composed of the Spring framework, the Struts framework, and the Hibernate framework and is a relatively classic web application construction framework model. Struts2 is the final implementation framework of the MVC model, and its hierarchical structure makes it necessary to focus only on the implementation of the specific business logic layer when building the platform. At the same time, only a simple configuration in the Struts configuration file can make corresponding countermeasures to various abnormal conditions of the platform. The Hibernate framework is nonintrusive when applied. At the same time, the framework provides an object-oriented HQL language, which simplifies the workload of connecting to the database. The Spring framework provides various management services for the entire web platform and performs persistence operations through Spring-Dao to complete operations such as adding, deleting, modifying, and checking data.The MINA server framework is a Socket communication framework for building data communication services, which has good scalability. At the same time, MINA introduces an asynchronous nonblocking mechanism and a multithreaded mechanism in the IO operation, so that the system can communicate with a large number of clients at the same time, which improves the performance of the system. The filtering layer in the MINA framework can achieve hierarchical processing of the underlying communication and business logic. Therefore, the use of MINA to build a data communication service system does not consider the complexity of the network layer, making the development process simple and straightforward.By adding support for Spring in MINA, at runtime, the system will inject the relationship between the programs into the corresponding components according to the content of the configuration file, so as to achieve loose coupling between classes. Therefore, at the technical level, this article combines MINA and SSH to jointly build an IoT sensor data processing platform, integrates the business logic layer of the web management platform and the data communication service system through Spring, and realizes the efficient operation of the entire platform. Figure2 shows the technical architecture diagram of the Internet of Things service platform. When the platform is started through the Tomcat server, the data communication service based on MINA and the web service based on SSH2 run at the same time and, finally, realize the communication service between the device terminal and the client terminal.Figure 2
Technical architecture of IoT sensor data processing platform.


## 4. Neural Network Model Based on IGA Optimization

### 4.1. The Combination of Neural Network and Genetic Algorithm

The main parameters describing the structure of an ANN model are the number of network layers, the number of units in each layer, the interconnection mode between units, and so on. Designing the structure of ANN is actually determining a combination of parameters suitable for solving a certain problem or a certain type of problem according to a certain performance evaluation criterion. When the problem to be solved is more complicated, it is more difficult to design ANN manually. The behavior of even small networks is difficult to understand. Large-scale, multilayer, nonlinear networks are even more mysterious, and there are almost no strict design rules. Under the conditions of a reasonable structure and appropriate weights, a three-layer feedforward network can approximate any continuous function, but the theorem does not give a method to determine the reasonable structure. The standard engineering design method is also powerless for the design of neural networks. The complex distributed interaction between network processing units makes the decomposition processing technology in modular design infeasible, and there is no direct analysis and design technology to deal with this complexity. What is more difficult is that even if we find a network that is sufficient to complete a specific task, we cannot be sure that we have not lost a better-performing network. So far, people have spent a lot of time and energy to solve this problem, and the application of neural networks is also developing in large-scale and complex forms. The method of manually designing the network should be discarded. ANN needs an efficient and automatic design method, and GA provides a good way for it.The system exists in the form of a network, but in the description and modeling of many problems, a certain analytical method is often used. Network analysis in operation research is only used to solve a class of engineering problems with obvious network forms. Regarding the network as the general description method of the system, and establishing the corresponding model and solution strategy, it is a subject that people are working hard to study. It is true that it is unwise to find a general system network representation, but it is feasible to use the current mature research of multilayer feedforward neural network (BP) as a problem representation method for genetic search. Figure3 shows the combination of genetic algorithm and neural network.Figure 3
Combination of genetic algorithm and neural network.


### 4.2. The Optimization Method of Genetic Algorithm to Neural Network

We use genetic algorithm to optimize neural network connection weights. Its essence is a complicated continuous parameter optimization problem, and the result is the optimal connection weight. Traditional neural network weighting algorithms all adopt certain weight change rules and finally get a better weight distribution after continuous learning and training. This method takes a long time to train and may even fall into a local minimum and fail to obtain a proper weight distribution. This problem can be solved by using genetic algorithm to optimize the weight of neural network.The determination of the fitness function is a key factor in the genetic algorithm. During the operation of the genetic algorithm, the choice of the fitness function directly determines the evolution of the genetic algorithm and determines whether the genetic algorithm can find a better one. As a result, the optimal solution or suboptimal solution is found. Therefore, in the evolution process of the genetic algorithm, it is necessary to ensure that the genetic evolution evolves in the direction of increasing the fitness function value.If you need to solve the problem of maximizing the objective functionfx, you can assume the fitness function, Ffx=fx; if you need to solve the problem, the objective function fx is a problem of minimization, so it can be assumed that the fitness function Ffx=−fx. This fitness function is relatively simple and easy to implement, but the fitness function in this way has the following two problems: one is that there may be some cases where the crossover probability that does not meet the requirements is negative, and the other is that the distribution of the function values solved in this way is relatively wide, so the average fitness obtained is not easy to express.If the objective function is the minimum problem, then(1)Ffx=fx−0.5Cmaxxmax≥fx,0.5xmax<fx.In the formula,Cmax is the maximum estimated value of fx. If the objective function is the biggest problem, then
(2)Ffx=fx−0.25Cminxmin≤fx,0.25xmin>fx.In the formula,Cmin is the minimum estimated value of fx. This method is an improvement of the first method, called the “boundary construction method,” but sometimes, there is a problem that it is difficult or inaccurate to estimate the threshold value in advance.If the objective function is the minimum problem, then(3)Ffx=2fx−c+0.5c>−fx.If the objective function is the biggest problem, then(4)Ffx=2fx+c−0.5c>fx.C is a conservative estimate of the bounds of the objective function. In the operation of genetic algorithm, the choice of fitness function directly determines the evolution of genetic algorithm and determines whether the genetic algorithm can find better results. Therefore, fitness function is crucial in genetic algorithm. Important steps are related to the quality of genetic algorithms.We use genetic algorithm to optimize the network structure. The problem of structural optimization is transformed into a biological evolution process, and the optimal solution of structural optimization is obtained through various evolutionary methods. Then, we use traditional algorithms to train the weights of the optimized structure.


### 4.3. IGA Is Applied to the Optimization of Neural Network Structure

We utilize the characteristics of the global search of genetic algorithm to find the most suitable network connection rights and network structure. For practical problems, the number of nodesn and m of the input layer and output layer of the feedforward multilayer neural network is determined by the problem itself. Therefore, the main task of network design is to determine the number of hidden layers of the network. Therefore, the problem is simplified to determine the number of nodes t in the hidden layer and the connection weight w. Generally, the maximum value of t is twice the number of nodes in the input layer.


#### 4.3.1. Chromosome Coding

Each chromosome corresponds to the topology of a neural network. The layer control gene is used to control the number of hidden layers of the neural network, the neuron control gene determines the neurons that are activated in each hidden layer, and the parameter gene is used to represent the connection weight and threshold of each neuron.Control genes are mainly used to control the structure of the entire network, including layer control genes and neuron control genes. Binary codes are generally used, with “1” indicating that the lower layer genes are in an active state and “0” indicating that the lower layer genes are in an inactive state. The parameter gene generally adopts the real number coding form, which can reduce the coding length of the chromosome. The population size is of great significance to the convergence of genetic algorithms. It is too small to obtain satisfactory results, and if it is too large, the calculation is complicated. Generally, the population size is 50-100.


#### 4.3.2. Crossover and Mutation

Layer control genes and neuron control genes generally use single-point crossover or multipoint crossover, which is mainly because one or more crossover points are randomly set in the individual code string, and then, the partial chromosomes of two or more paired individuals are exchanged at the crossover points.The parameter gene uses arithmetic crossover, which refers to the production of two new human bodies by the linear combination of two individuals. Assuming an arithmetic crossover between two individualsXA and XB, the two new individuals generated after the crossover are
(5)XA′=aXA−a−1XB,XB′=aXB−a−1XA.Crossover operation is the main way to generate new individuals in genetic algorithm. The crossover probability is generally larger, and the recommended range is 0.4 to 0.99. The mutation operation includes the mutation of the control gene and the parameter gene it controls. The mutation of the control gene changes the “1” in the control gene string to “0” or from “0” to “1” with a certain probability. The operation will change the structure of the hidden layer, and the favorable mutation will be preserved through the selection operation.


#### 4.3.3. Optimal Design of Neural Network Structure Based on IGA

Introducing genetic algorithm into neural network is a new direction of neural network research. The IGA algorithm proposed in this paper can optimize the structure and weight of the neural network at the same time. It is a random search algorithm that can converge to the global optimum in the sense of probability.A three-tier hierarchical structure is adopted. The second level is the layer control gene to control the number of hidden layers of ANN, and the first level is the neuron control gene, which determines the neurons that are activated in each hidden layer. Control genes are coded in binary, with “1” indicating that the underlying genes are in an active state and “0” indicating that they are in an inactive state. The parameter gene is used to represent the connection weight and threshold of each neuron, using real number coding.We calculate the fitness value of each individual and sort the individuals in the population from high to low fitness, whereE=meansquareerroroftrainingdata+networkcomplexity. The complexity function is the number of active connection weights in the network divided by the number of all connection weights in the network (including active and inactive). We take adaptive crossover:
(6)Pc=Pc1f>f′,Pc=Pc1+f−f′fmax−f·Pc1−Pc2f≤f′,wheref′ is the larger fitness value of the two crossover strings, Pc1=0.9 and Pc2=0.6. We take adaptive mutation:
(7)Pm=Pm1f>f′,Pm=Pm1+fmax−ffmax−f′·Pm1−Pm2f≤f′,where f is the fitness value of the mutation string, Pm1=0.1 and Pm2=0.001. The algorithm flow chart is shown in Figure 4.Figure 4
IGA optimization ANN structure flow chart.


## 4.1. The Combination of Neural Network and Genetic Algorithm

The main parameters describing the structure of an ANN model are the number of network layers, the number of units in each layer, the interconnection mode between units, and so on. Designing the structure of ANN is actually determining a combination of parameters suitable for solving a certain problem or a certain type of problem according to a certain performance evaluation criterion. When the problem to be solved is more complicated, it is more difficult to design ANN manually. The behavior of even small networks is difficult to understand. Large-scale, multilayer, nonlinear networks are even more mysterious, and there are almost no strict design rules. Under the conditions of a reasonable structure and appropriate weights, a three-layer feedforward network can approximate any continuous function, but the theorem does not give a method to determine the reasonable structure. The standard engineering design method is also powerless for the design of neural networks. The complex distributed interaction between network processing units makes the decomposition processing technology in modular design infeasible, and there is no direct analysis and design technology to deal with this complexity. What is more difficult is that even if we find a network that is sufficient to complete a specific task, we cannot be sure that we have not lost a better-performing network. So far, people have spent a lot of time and energy to solve this problem, and the application of neural networks is also developing in large-scale and complex forms. The method of manually designing the network should be discarded. ANN needs an efficient and automatic design method, and GA provides a good way for it.The system exists in the form of a network, but in the description and modeling of many problems, a certain analytical method is often used. Network analysis in operation research is only used to solve a class of engineering problems with obvious network forms. Regarding the network as the general description method of the system, and establishing the corresponding model and solution strategy, it is a subject that people are working hard to study. It is true that it is unwise to find a general system network representation, but it is feasible to use the current mature research of multilayer feedforward neural network (BP) as a problem representation method for genetic search. Figure3 shows the combination of genetic algorithm and neural network.Figure 3
Combination of genetic algorithm and neural network.


## 4.2. The Optimization Method of Genetic Algorithm to Neural Network

We use genetic algorithm to optimize neural network connection weights. Its essence is a complicated continuous parameter optimization problem, and the result is the optimal connection weight. Traditional neural network weighting algorithms all adopt certain weight change rules and finally get a better weight distribution after continuous learning and training. This method takes a long time to train and may even fall into a local minimum and fail to obtain a proper weight distribution. This problem can be solved by using genetic algorithm to optimize the weight of neural network.The determination of the fitness function is a key factor in the genetic algorithm. During the operation of the genetic algorithm, the choice of the fitness function directly determines the evolution of the genetic algorithm and determines whether the genetic algorithm can find a better one. As a result, the optimal solution or suboptimal solution is found. Therefore, in the evolution process of the genetic algorithm, it is necessary to ensure that the genetic evolution evolves in the direction of increasing the fitness function value.If you need to solve the problem of maximizing the objective functionfx, you can assume the fitness function, Ffx=fx; if you need to solve the problem, the objective function fx is a problem of minimization, so it can be assumed that the fitness function Ffx=−fx. This fitness function is relatively simple and easy to implement, but the fitness function in this way has the following two problems: one is that there may be some cases where the crossover probability that does not meet the requirements is negative, and the other is that the distribution of the function values solved in this way is relatively wide, so the average fitness obtained is not easy to express.If the objective function is the minimum problem, then(1)Ffx=fx−0.5Cmaxxmax≥fx,0.5xmax<fx.In the formula,Cmax is the maximum estimated value of fx. If the objective function is the biggest problem, then
(2)Ffx=fx−0.25Cminxmin≤fx,0.25xmin>fx.In the formula,Cmin is the minimum estimated value of fx. This method is an improvement of the first method, called the “boundary construction method,” but sometimes, there is a problem that it is difficult or inaccurate to estimate the threshold value in advance.If the objective function is the minimum problem, then(3)Ffx=2fx−c+0.5c>−fx.If the objective function is the biggest problem, then(4)Ffx=2fx+c−0.5c>fx.C is a conservative estimate of the bounds of the objective function. In the operation of genetic algorithm, the choice of fitness function directly determines the evolution of genetic algorithm and determines whether the genetic algorithm can find better results. Therefore, fitness function is crucial in genetic algorithm. Important steps are related to the quality of genetic algorithms.We use genetic algorithm to optimize the network structure. The problem of structural optimization is transformed into a biological evolution process, and the optimal solution of structural optimization is obtained through various evolutionary methods. Then, we use traditional algorithms to train the weights of the optimized structure.


## 4.3. IGA Is Applied to the Optimization of Neural Network Structure

We utilize the characteristics of the global search of genetic algorithm to find the most suitable network connection rights and network structure. For practical problems, the number of nodesn and m of the input layer and output layer of the feedforward multilayer neural network is determined by the problem itself. Therefore, the main task of network design is to determine the number of hidden layers of the network. Therefore, the problem is simplified to determine the number of nodes t in the hidden layer and the connection weight w. Generally, the maximum value of t is twice the number of nodes in the input layer.


### 4.3.1. Chromosome Coding

Each chromosome corresponds to the topology of a neural network. The layer control gene is used to control the number of hidden layers of the neural network, the neuron control gene determines the neurons that are activated in each hidden layer, and the parameter gene is used to represent the connection weight and threshold of each neuron.Control genes are mainly used to control the structure of the entire network, including layer control genes and neuron control genes. Binary codes are generally used, with “1” indicating that the lower layer genes are in an active state and “0” indicating that the lower layer genes are in an inactive state. The parameter gene generally adopts the real number coding form, which can reduce the coding length of the chromosome. The population size is of great significance to the convergence of genetic algorithms. It is too small to obtain satisfactory results, and if it is too large, the calculation is complicated. Generally, the population size is 50-100.


### 4.3.2. Crossover and Mutation

Layer control genes and neuron control genes generally use single-point crossover or multipoint crossover, which is mainly because one or more crossover points are randomly set in the individual code string, and then, the partial chromosomes of two or more paired individuals are exchanged at the crossover points.The parameter gene uses arithmetic crossover, which refers to the production of two new human bodies by the linear combination of two individuals. Assuming an arithmetic crossover between two individualsXA and XB, the two new individuals generated after the crossover are
(5)XA′=aXA−a−1XB,XB′=aXB−a−1XA.Crossover operation is the main way to generate new individuals in genetic algorithm. The crossover probability is generally larger, and the recommended range is 0.4 to 0.99. The mutation operation includes the mutation of the control gene and the parameter gene it controls. The mutation of the control gene changes the “1” in the control gene string to “0” or from “0” to “1” with a certain probability. The operation will change the structure of the hidden layer, and the favorable mutation will be preserved through the selection operation.


### 4.3.3. Optimal Design of Neural Network Structure Based on IGA

Introducing genetic algorithm into neural network is a new direction of neural network research. The IGA algorithm proposed in this paper can optimize the structure and weight of the neural network at the same time. It is a random search algorithm that can converge to the global optimum in the sense of probability.A three-tier hierarchical structure is adopted. The second level is the layer control gene to control the number of hidden layers of ANN, and the first level is the neuron control gene, which determines the neurons that are activated in each hidden layer. Control genes are coded in binary, with “1” indicating that the underlying genes are in an active state and “0” indicating that they are in an inactive state. The parameter gene is used to represent the connection weight and threshold of each neuron, using real number coding.We calculate the fitness value of each individual and sort the individuals in the population from high to low fitness, whereE=meansquareerroroftrainingdata+networkcomplexity. The complexity function is the number of active connection weights in the network divided by the number of all connection weights in the network (including active and inactive). We take adaptive crossover:
(6)Pc=Pc1f>f′,Pc=Pc1+f−f′fmax−f·Pc1−Pc2f≤f′,wheref′ is the larger fitness value of the two crossover strings, Pc1=0.9 and Pc2=0.6. We take adaptive mutation:
(7)Pm=Pm1f>f′,Pm=Pm1+fmax−ffmax−f′·Pm1−Pm2f≤f′,where f is the fitness value of the mutation string, Pm1=0.1 and Pm2=0.001. The algorithm flow chart is shown in Figure 4.Figure 4
IGA optimization ANN structure flow chart.


## 4.3.1. Chromosome Coding

Each chromosome corresponds to the topology of a neural network. The layer control gene is used to control the number of hidden layers of the neural network, the neuron control gene determines the neurons that are activated in each hidden layer, and the parameter gene is used to represent the connection weight and threshold of each neuron.Control genes are mainly used to control the structure of the entire network, including layer control genes and neuron control genes. Binary codes are generally used, with “1” indicating that the lower layer genes are in an active state and “0” indicating that the lower layer genes are in an inactive state. The parameter gene generally adopts the real number coding form, which can reduce the coding length of the chromosome. The population size is of great significance to the convergence of genetic algorithms. It is too small to obtain satisfactory results, and if it is too large, the calculation is complicated. Generally, the population size is 50-100.


## 4.3.2. Crossover and Mutation

Layer control genes and neuron control genes generally use single-point crossover or multipoint crossover, which is mainly because one or more crossover points are randomly set in the individual code string, and then, the partial chromosomes of two or more paired individuals are exchanged at the crossover points.The parameter gene uses arithmetic crossover, which refers to the production of two new human bodies by the linear combination of two individuals. Assuming an arithmetic crossover between two individualsXA and XB, the two new individuals generated after the crossover are
(5)XA′=aXA−a−1XB,XB′=aXB−a−1XA.Crossover operation is the main way to generate new individuals in genetic algorithm. The crossover probability is generally larger, and the recommended range is 0.4 to 0.99. The mutation operation includes the mutation of the control gene and the parameter gene it controls. The mutation of the control gene changes the “1” in the control gene string to “0” or from “0” to “1” with a certain probability. The operation will change the structure of the hidden layer, and the favorable mutation will be preserved through the selection operation.


## 4.3.3. Optimal Design of Neural Network Structure Based on IGA

Introducing genetic algorithm into neural network is a new direction of neural network research. The IGA algorithm proposed in this paper can optimize the structure and weight of the neural network at the same time. It is a random search algorithm that can converge to the global optimum in the sense of probability.A three-tier hierarchical structure is adopted. The second level is the layer control gene to control the number of hidden layers of ANN, and the first level is the neuron control gene, which determines the neurons that are activated in each hidden layer. Control genes are coded in binary, with “1” indicating that the underlying genes are in an active state and “0” indicating that they are in an inactive state. The parameter gene is used to represent the connection weight and threshold of each neuron, using real number coding.We calculate the fitness value of each individual and sort the individuals in the population from high to low fitness, whereE=meansquareerroroftrainingdata+networkcomplexity. The complexity function is the number of active connection weights in the network divided by the number of all connection weights in the network (including active and inactive). We take adaptive crossover:
(6)Pc=Pc1f>f′,Pc=Pc1+f−f′fmax−f·Pc1−Pc2f≤f′,wheref′ is the larger fitness value of the two crossover strings, Pc1=0.9 and Pc2=0.6. We take adaptive mutation:
(7)Pm=Pm1f>f′,Pm=Pm1+fmax−ffmax−f′·Pm1−Pm2f≤f′,where f is the fitness value of the mutation string, Pm1=0.1 and Pm2=0.001. The algorithm flow chart is shown in Figure 4.Figure 4
IGA optimization ANN structure flow chart.


## 5. Simulation Experiment and Result Analysis

### 5.1. Numerical Simulation of Shock Piezoelectric Response of Test Piece

In order to realize the subsequent optimization of the sensor configuration on the upper wall of the test piece using the genetic neural network method, according to the actual structure of the upper wall, the simulation method is adopted, and as many sensors as possible are first arranged on the surface of the upper wall. Because there are 6 ribs on the surface of the upper wall panel, and the wall panels are connected to the four peripheries, there are 5 ribs in the middle for support. Therefore, there are actually 42 positions where sensors can be deployed. If a piezoelectric sensor is arranged in the center of each position, a total of 42 sensors can be arranged on the surface of the upper wall plate. There are 42 piezoelectric sensors on the reverse side of the upper wall of the test piece (the side where the ribs are glued). Since the upper wall is symmetrical, the letter “L” is used to indicate the left half of the upper wall, and “R” is the right half of the upper wall, and each sensor is numbered separately, and the sensor number is specified to be consistent with its layout position number. The size of the arranged piezoelectric chip sensor is60mm×40mm×0.25mm, and its material is PZT-5 piezoelectric ceramics.Due to the complex structure of the test piece, it is too cumbersome to model with solid elements. Therefore, this paper uses shell elements for modeling, that is, the upper wall plate adopts the SHELL99 shell element based on the classic laminate theory, and it is bonded to the upper wall plate. The piezoelectric sheet uses PLANE13 plane elements and is polarized in they-direction; the wall panels and ribs use SHELL93 shell elements, and the difference in thickness is controlled by real constants. In order to further simplify the finite element model of the test piece in order to reduce the workload of calculation, the lower wall slab is ignored during modeling, and rigid boundary conditions are applied at the connection of the wall slab, the rib, and the lower wall slab; the structural symmetry of the symmetrical boundary condition DSYM is used to establish a half model of its structure. The distribution of finite element sensors on the right half of the test piece is shown in Figure 5.Figure 5
The distribution of finite element sensors on the right half of the test piece.Using the impact load shown in Figure6, the impact simulation test is performed on the right half of the model of the test piece, the transient response signals of each piezoelectric sensor are obtained, and the feature extraction is performed. Since the piezoelectric sheet uses the planar element PLANE13 and is polarized in the y-direction, the difference between the response signals of the upper boundary middle node (referred to as the upper node) and the lower boundary middle node (referred to as the lower node) of the piezoelectric sheet is used for feature extraction. The response signal of the piezoelectric sensor 8 is shown in Figure 7. It can be seen that the optimized value of IGA-ANN is relatively close to the expected value of the response signal, while the unoptimized value is very different from the expected value of the response signal.Figure 6
Time history curve of impact load.Figure 7
Response signal of piezoelectric sensor 8.


### 5.2. Optimal Configuration of Test Piece Sensors Based on Genetic Neural Network

The feature extraction is performed on the response signals of each sensor, respectively, and the different impact positions and the corresponding signal feature data of different sensors are obtained. This provides training and test samples for the use of IGA-ANN for impact damage location detection, so as to realize the optimal configuration of sensors based on damage detection. The optimal configuration of the test piece sensor takes time as shown in Figure8. It can be seen that the optimized configuration time-consuming value of IGA-ANN is basically the same as the expected configuration time-consuming value, while the unoptimized configuration time-consuming value is larger.Figure 8
Optimal configuration of test piece sensors takes time.Regarding the layout mode of the wall plate sensor on the test piece, although the maximum possible arrangement of 42 sensors is expected to reduce the detection error, that is, it can improve the detection efficiency, but too many sensors increase the workload of signal processing, and it is used in conjunction with the sensor. The cost of data acquisition and processing equipment is high, and the sensor itself requires a certain cost, that is, the overall cost has increased. Therefore, considering the comprehensive cost and benefit, the layout mode of the sensor is not optimal. For this reason, it can be considered to appropriately reduce the benefits of detection and to reduce the cost as much as possible, that is, to reduce the number of sensors as much as possible while increasing the detection error as little as possible, so as to achieve the maximum number and location of the test piece sensors.Using the genetic neural network method, based on the impact damage location detection problem, we optimize the sensor configuration of the right half of the test piece model and then realize the optimal configuration of the entire test piece sensor.The genetic neural network method is used to optimize the sensor placement when the number of sensors. In the optimization process, we take relevant data for different sensor placement modes to perform IGA-ANN training and testing and finally obtain the optimal placement positions of different numbers of sensors. These figures show that due to the symmetry of the structure and boundary conditions of the test piece, the optimal placement positions of the different numbers of sensors are also symmetrical about the structure. The detection error of the impact damage position of IGA-ANN with different numbers of sensors is shown in Figure9. The results show that for the initial placement of more sensors, the IGA-ANN method can effectively reduce the detection error. This simulation result can provide a certain guiding basis for the optimal configuration of the actual piezoelectric sensor of the structure test piece.Figure 9
Detection error of different numbers of sensors.


## 5.1. Numerical Simulation of Shock Piezoelectric Response of Test Piece

In order to realize the subsequent optimization of the sensor configuration on the upper wall of the test piece using the genetic neural network method, according to the actual structure of the upper wall, the simulation method is adopted, and as many sensors as possible are first arranged on the surface of the upper wall. Because there are 6 ribs on the surface of the upper wall panel, and the wall panels are connected to the four peripheries, there are 5 ribs in the middle for support. Therefore, there are actually 42 positions where sensors can be deployed. If a piezoelectric sensor is arranged in the center of each position, a total of 42 sensors can be arranged on the surface of the upper wall plate. There are 42 piezoelectric sensors on the reverse side of the upper wall of the test piece (the side where the ribs are glued). Since the upper wall is symmetrical, the letter “L” is used to indicate the left half of the upper wall, and “R” is the right half of the upper wall, and each sensor is numbered separately, and the sensor number is specified to be consistent with its layout position number. The size of the arranged piezoelectric chip sensor is60mm×40mm×0.25mm, and its material is PZT-5 piezoelectric ceramics.Due to the complex structure of the test piece, it is too cumbersome to model with solid elements. Therefore, this paper uses shell elements for modeling, that is, the upper wall plate adopts the SHELL99 shell element based on the classic laminate theory, and it is bonded to the upper wall plate. The piezoelectric sheet uses PLANE13 plane elements and is polarized in they-direction; the wall panels and ribs use SHELL93 shell elements, and the difference in thickness is controlled by real constants. In order to further simplify the finite element model of the test piece in order to reduce the workload of calculation, the lower wall slab is ignored during modeling, and rigid boundary conditions are applied at the connection of the wall slab, the rib, and the lower wall slab; the structural symmetry of the symmetrical boundary condition DSYM is used to establish a half model of its structure. The distribution of finite element sensors on the right half of the test piece is shown in Figure 5.Figure 5
The distribution of finite element sensors on the right half of the test piece.Using the impact load shown in Figure6, the impact simulation test is performed on the right half of the model of the test piece, the transient response signals of each piezoelectric sensor are obtained, and the feature extraction is performed. Since the piezoelectric sheet uses the planar element PLANE13 and is polarized in the y-direction, the difference between the response signals of the upper boundary middle node (referred to as the upper node) and the lower boundary middle node (referred to as the lower node) of the piezoelectric sheet is used for feature extraction. The response signal of the piezoelectric sensor 8 is shown in Figure 7. It can be seen that the optimized value of IGA-ANN is relatively close to the expected value of the response signal, while the unoptimized value is very different from the expected value of the response signal.Figure 6
Time history curve of impact load.Figure 7
Response signal of piezoelectric sensor 8.


## 5.2. Optimal Configuration of Test Piece Sensors Based on Genetic Neural Network

The feature extraction is performed on the response signals of each sensor, respectively, and the different impact positions and the corresponding signal feature data of different sensors are obtained. This provides training and test samples for the use of IGA-ANN for impact damage location detection, so as to realize the optimal configuration of sensors based on damage detection. The optimal configuration of the test piece sensor takes time as shown in Figure8. It can be seen that the optimized configuration time-consuming value of IGA-ANN is basically the same as the expected configuration time-consuming value, while the unoptimized configuration time-consuming value is larger.Figure 8
Optimal configuration of test piece sensors takes time.Regarding the layout mode of the wall plate sensor on the test piece, although the maximum possible arrangement of 42 sensors is expected to reduce the detection error, that is, it can improve the detection efficiency, but too many sensors increase the workload of signal processing, and it is used in conjunction with the sensor. The cost of data acquisition and processing equipment is high, and the sensor itself requires a certain cost, that is, the overall cost has increased. Therefore, considering the comprehensive cost and benefit, the layout mode of the sensor is not optimal. For this reason, it can be considered to appropriately reduce the benefits of detection and to reduce the cost as much as possible, that is, to reduce the number of sensors as much as possible while increasing the detection error as little as possible, so as to achieve the maximum number and location of the test piece sensors.Using the genetic neural network method, based on the impact damage location detection problem, we optimize the sensor configuration of the right half of the test piece model and then realize the optimal configuration of the entire test piece sensor.The genetic neural network method is used to optimize the sensor placement when the number of sensors. In the optimization process, we take relevant data for different sensor placement modes to perform IGA-ANN training and testing and finally obtain the optimal placement positions of different numbers of sensors. These figures show that due to the symmetry of the structure and boundary conditions of the test piece, the optimal placement positions of the different numbers of sensors are also symmetrical about the structure. The detection error of the impact damage position of IGA-ANN with different numbers of sensors is shown in Figure9. The results show that for the initial placement of more sensors, the IGA-ANN method can effectively reduce the detection error. This simulation result can provide a certain guiding basis for the optimal configuration of the actual piezoelectric sensor of the structure test piece.Figure 9
Detection error of different numbers of sensors.


## 6. Conclusion

This paper presents the overall design framework of the IoT sensor data processing platform and elaborates the advantages of using SSH and MINA to build the platform integratedly. The platform is divided into two parts, a web management platform and a data communication service system, and interacts with the database by integrating the business layers of the two into one. The web management platform provides services such as customizable communication protocol customization, equipment information, personal information, announcement information management, and data collection information monitoring and analysis. The sensor data communication service system is responsible for realizing the communication service between the client terminal and the device terminal and the data processing service of the sensor data collected by the device. The system we are facing is becoming more and more complex, and the system problems we deal with are becoming more and more complex. It is very difficult to express the regularity of complex systems with the string representation method in traditional GA. The tree structure is used in genetic planning, which can easily express the hierarchy in the problem. We adopt an excellent individual strategy and retain a few of the best (high fitness value) individuals in each generation not to participate in selection and mutation operations. We find the most adaptive individuals and the least adaptive individuals in the current population. If the fitness of the best individual in the current group is higher than the fitness of the total best individual so far, the best individual in the current group is taken as the new best individual. We replace the worst individual in the current population with the best individual so far. We use IGA to optimize the neural network, so that IGA can optimize both the structure of the network and the weight of the network. In this paper, the structure of the wing box test piece is analyzed, using the finite element method, the finite element model of the wing box test piece is established, and the shock piezoelectric response numerical simulation is carried out. Using the genetic neural network method, based on the impact damage location detection problem, the piezoelectric sensor of the test piece of the wing box section is optimized, and the optimal configuration of the sensor is obtained in the initial layout mode. Compared with the situation when all 42 sensors are selected in the initial sensor layout mode, only 24 sensors are now required, that is, the number of sensors is reduced by 18, and the cost is reduced. Although the damage detection error has been improved, the comprehensive evaluation index of cost and benefit is the best. This simulation result can provide a certain value for the optimal configuration of the actual piezoelectric sensor of the structure test piece.The current genetic algorithm learning human evolution process is only formal; it has not been able to characterize the evolution process of human itself, let alone the real learning process of neuronal thinking. These are reflected in the fact that the realization of the existing genetic algorithm is affected by many factors and fails to form a systematic theory. Therefore, the genetic algorithm needs more in-depth discussion in terms of its model. The current research on genetic algorithms is just the beginning. It is necessary to examine the current status of genetic algorithms from a higher height and broader perspective and to explore a new way for the future. When the genetic neural network method is used to optimize the placement of sensors, the feasibility analysis adopts engineering judgment and gives a certain explanation. However, the engineering judgment method is rough, and sometimes, it is necessary to delve into the theoretical basis behind the problem and seek the verification of the relevant theory. This is also the difficulty of the problem and needs to be studied in depth.



---

*Source: 5098013-2021-08-23.xml*