An Edge Computing Offload Method Based on NSGA-II for Power Internet of Things

In the ubiquitous power Internet of things, all kinds of growing power terminal equipment and business applications will generate massive data, which will cause huge pressure to the master station, and high delay and security cannot meet the requirements of new business forms. Edge computing organically integrates computing, storage, and other resources on the edge of the network and responds to the task request of the network edge node timely and effectively according to the principle of nearest service. Due to the limited resources of edge nodes, such as power monitoring camera capability, resources, bandwidth, energy, etc., computing offload is a key problem of edge computing. To solve this problem, this paper proposes a method of edge computing offload based on genetic algorithm. Firstly, in the edge-computing scenario of the power Internet of things, we analyze the computing unloading problem model under the time sequence condition. Then, aiming at the optimal decision-making problem of energy consumption and time delay of terminal equipment, we creatively transform the problem of computational offload into the problem of multi-objective optimization. In the genetic algorithm, we use NSGA-II to achieve the multi-objective optimization of the decision-making. Through conversion, time delay and energy consumption, the optimization can be achieved. Finally, we designed a simulation experiment. The results show that the unloading decision of NSGA-II can reach the best. The results show that the results of NSGA-II can be distributed in a wider range.


Introduction
In 2019, State Grid Co., Ltd. put forward a new goal of "three types and two networks". The goal of power Internet of things construction has emerged, and the prelude of related construction has officially opened [10]. In the architecture of ubiquitous power Internet of things, the sensing terminal is responsible for state data collection and the edge computing is responsible for real-time analysis of state data [16]. With the rapid increase of the number of edge terminal devices and computing tasks, the traditional cloud computing performance appears bottleneck, which leads to the decrease of computing speed and the increase of delay and jitter [13,28,31]. While edge computing provides services to the nearest side, which reduces the pressure of the main station by putting a lot of computing to the execution end, meets the requirements of real-time data analysis and processing and low delay business, reduces the operation and maintenance cost, and improves the system efficiency [14,20,25]. For example, for the real-time monitoring of transmission lines, many transmission lines are in remote areas, the network environment is poor, and it is difficult to real-time monitor manually. Holographic sensing equipment analyzes the data of sensors, surveillance cameras and other data directly to identify potential threats to the security of the power grid, including people, vehicles, fire, and electric shock. Through edge computing, only the information that needs to be earlywarning is uploaded to the cloud, thus greatly reducing the cost of communication bandwidth and computing delay [2,8,12]. In edge computing, computing offload technology offloads the computing tasks of the terminal to the edge network, which solves the shortcomings of the devices in resource storage, computing performance and energy efficiency [27].
At the same time, compared with computing offload in cloud computing, edge computing offload solves the problems of network resource occupation, high delay, and extra network load [3,7,11]. The first step of unloading decision is to calculate whether the task should be unloaded or not. The key is to compare the cost of local processing task and edge server processing task, and then judge whether unloading is valuable. A poor offload decision may result in multiple processing delays and energy consumption [1,18,22,23]. Therefore, how to design and calculate unloading scheme reasonably is a key problem of edge computing [26]. Energy and time delay are the key design goals of edge computing. Achieving one uninstall goal may affect the other. For example, executing a task on an edge server may reduce the response time of the task, but it may not save the battery power of the terminal device [17,24,29]. It is a nontrivial multi-objective optimization problem to study the trade-off between energy consumption and response time [30].
Common optimization algorithms include ant colony algorithm, particle swarm algorithm, genetic algorithm, etc [5,6,9]. Among many algorithms, genetic algorithm is very popular because of its great search ability and convergence speed. Multi-objective genetic algorithm is an evolutionary algorithm used to analyze and solve multi-objective optimization problems. Its core is to coordinate the relationship between various objective functions and find out the optimal solution set that makes each objective function reach a larger (or smaller) function value as much as possible [15,19,21]. NSGA-II algorithm is the most influential and widely used multi-objective genetic algorithm in multiobjective optimization [4].
Therefore, considering the need to adapt to different application scenarios, communication conditions and the computing resources of the base station, the decision-making of computing offload needs to be integrated. In this paper, an edge computing offload method based on NSGA-II is proposed for effective computing offload and resource allocation, to balance the time delay and energy consumption of task execution. The research goal of this paper is to reduce the energy consumption and time cost of the whole system as much as possible while considering that the edge server shares the huge task of cloud computing.
The structure of this paper is as follows. In the second section, the edge computing unloading method of power Internet of things based on NSGA-II is proposed. The third section introduces the experimental simulation and the comparison results. At last, we give the concluding remarks.

An Edge Computation Offload Method Based on Nsga-II
A. System modeling 1) Network modeling: Consider the scenario of multiple terminal devices in single plant area. The base station is deployed with a high-performance server, which can provide computing services for multiple terminal devices in the plant area. The set of terminal devices is expressed as {1, 2,..., } N N = Suppose that each terminal device has a computing intensive task to complete, which can be executed locally or uninstalled to the base station server. In this case, we only consider the two-state offloading of computing tasks, that is all tasks are intelligently selected to be offloaded to the base station server or executed locally. The so-called two-state unloading refers to the offloading decision is described as 0 and 1. 0 means execute locally; 1 means offload tasks to edge computing server.
We use time division multiplexing to share wireless links. Time division multiplexing can reduce the total delay of all tasks. In this way, a time frame is divided into multiple time slices on average for communication between terminal equipment and base station. Therefore, only one task in a time slice can be unloaded to the edge computing server for execution, which reduces the transmission delay of single task and reduces the waiting time of multiple tasks competing for computing resources on the server side.
If device n chooses to offload the task, the data transmission rate of the terminal device is (1) where B is the bandwidth of the wireless channel, n P represents the transmission power of the device n for uploading data, n g represents the channel gain between the device n and the base station, 0 N is the variance of white Gaussian noise.
2) Task modeling: Consider that each device has a compute intensive task to calculate. The task corresponding to each terminal device n corresponds to a quadruple, ( , , , ) off n n n n T v s a t ≜ . n is the number of devices and off t is the upload time. Where n v represents the amount of data for the task to be performed, including input parameters and program code. n s represents the amount of computation, that is, the number of CPU execution rounds required to calculate the task. Because the computing power of the edge computing server is different from that of the device, the running time of the same task is also different. If tasks arrive randomly, the arrival time of each task is n a . off t indicates the task upload time. The information of these four parameters related to tasks can be estimated by task analyzer.
When the device has a task to execute, it needs to first send a request to the base station, which contains all the information of the task; then wait for the base station to decide to offload. Tasks that have arrived but have not been executed will wait for the scheduling of the base station. Since only one task can be executed at the same time on the server at the base station, there is a queue to store the tasks waiting to be executed. The uninstall decisions defined for device n are: If the base station decides to offload the task to the edge computing server, the base station will set 0 α = , otherwise 1 α = .
3) Computing modeling: Because the task can be executed at the base station end, it can also be executed at the device end. Therefore, the calculation model is divided into two parts: local computing model and offloading computing model. The local computing model represents the use of the computing resources of the terminal device itself to perform tasks. The offloading computing model represents that the base station decides to offload the task to the edge computing server and uses the computing resources of the server to process the task.
(1) Local computing model If the base station decides to execute the computing task locally, define n T as the delay of local computing, that is, the processing time of the local CPU. If the computing power of the device n is n f , and the local execution delay is Defined n E as the energy consumption in the local execution process, that is, the energy of the local computing. So, n z is the energy consumption density, and the parameter difference between different equipment is very small.
(2) Offloading computing model If the edge computing server is selected to perform the task, the device will first uninstall the task to the edge computing server through the wireless channel, and then the edge computing server will perform the task. The whole unloading process consists of three parts. First, the device needs to upload the program code and parameter related information to the base station through the wireless channel, and then the base station forwards the relevant information to the edge computing server.
Then, the edge computing server needs to allocate corresponding computing resources to perform tasks. Finally, the base station returns the computing results to the device.
Therefore, the delay of offloading processing is divided into three parts. The first part is the transmission delay caused by the input data n v . The data transmission delay depends on the available offloading rate n r .
Any time slice after sending task related information to the base station may offload task data to the base station server. Therefore, the time when the device uploads data through the wireless channel is recorded as off t . Since only one task can be executed on the edge computing server at the same time, other tasks may be scheduled on the local device and offloaded to the edge computing server at a certain time slice in the future, or they may have been offloaded to the edge computing server for execution. Considering that there are usually multiple tasks waiting to be executed on the edge computing server, there is a first in first out queue in the server to store the offloaded tasks. Once the executing task is finished, the server will get the next task from the queue. Define the time when the task starts executing at the edge calculation server as exe t , so The second part of the execution delay is the processing delay of the edge computing server n s . When the edge computing server executes a task, assuming it occupies all computing resources, the execution delay The third part of the offload processing delay is the return delay. The prior researches show that the amount of data in the calculation results is very small compared with the amount of data offloaded. Therefore, the return delay is ignored in this paper. The total delay in the calculation of the unloading is

B. Problem modeling
In this paper, we consider both time delay and energy consumption, and try to find the optimal solution set which can make the two objective functions of delay and energy consumption reach a relatively small value as much as possible. The device selects one of the computing ways of local computing or offloading computing. The problem model is as follows: Constraint C1 guarantees that each task can only be processed by local computing or offloading to edge computing server. Constraint C2 means that the task needs to be offloaded to edge computing server first before it can be executed.
C. Multi-objective genetic algorithm Genetic algorithm is a computational model simulating the natural selection and genetic mechanism of Darwinian biological evolution. It is a method to search the optimal solution by simulating the natural evolution. Its main characteristics are direct operation on the structure object, without the limitation of derivation and function continuity; inherent implicit parallelism and better global optimization ability; using probabilistic optimization method, the search space can be obtained and guided automatically without certain rules, and the search direction can be adjusted adaptively. Genetic algorithm takes all individuals in a population as objects and uses randomization technology to guide the efficient search of a coded parameter space. Among them, selection, crossover, and mutation constitute the genetic operation of genetic algorithm; parameter coding, setting of initial population, design of fitness function, design of genetic operation and setting of control parameters constitute the core content of genetic algorithm.
Multi-objective genetic algorithm is an evolutionary algorithm used to analyze and solve multi-objective optimization problems. Its core is to coordinate the relationship between various objective functions and find out the optimal solution set that makes each objective function reach a larger (or smaller) function value as much as possible. Among many multi-objective optimization genetic algorithms, NSGA-II algorithm is a multi-objective optimization algorithm based on Pareto optimal solution, which is the most influential and widely used multi-objective genetic algorithm. After its appearance, the algorithm has become one of the basic algorithms in multi-objective optimization problems because of its simple, effective, and obvious advantages. The main advantages (improvements) of the algorithm are as follows [4]: 1) A fast-non-dominated sorting algorithm is proposed, which reduces the complexity of calculating the nondominated order and reduces the complexity of the optimization algorithm from the original 3 mN to 2 mN . m is the number of objective functions and N is the size of the population.
2) The elite strategy is introduced to expand the sampling space. The combination of the parent population and the offspring population will generate the next generation population through competition, which is conducive to the maintenance of the excellent individuals in the parent generation, to ensure that those excellent individuals are not discarded in the evolution process, to improve the accuracy of the optimization results. And by storing all individuals in layers, the best individuals will not be lost, and the population level can be rapidly improved.
3) Introduce crowding degree and crowding degree comparison operator, which not only overcomes the defect of NSGA that needs to specify the shared parameters artificially, but also takes crowding degree as the comparison criterion between individuals in the population, so that the population individuals in the quasi Pareto domain can be evenly extended to the whole Pareto domain, thus ensuring the diversity of the population.
Because the problem proposed in this paper is a NP-hard problem, the complexity of solving the optimal solution is high. Considering the idea of multi-objective optimization rather than single objective optimization, the efficiency of using NSGA-II method to get the optimal solution is high. In the multi-objective optimization problem, it is usually necessary to measure the impact of each objective variable on the overall objective, but when considering the multiobjective method, NSGA-II method not only uses the proportion or weight of each objective to measure, the measurement standard is more balanced and comprehensive.

Simulation Experiment
To verify that the proposed method based on NSGA-II can be effectively applied in the power IOT, the following simulation experiments are done. The simulation experiment of this paper uses Python platform to train the genetic algorithm model. The results show that the unloading decision of NSGA-II can reach the optimum. The results show that the results of NSGA-II can be distributed in a wider range.

Simulation Settings
Suppose that there are n edge nodes, one base station and one edge computing server in the wireless network scenario of a single plant area. The topology is as shown in the figure.
In this experiment, we assume that each task has only two kinds of decision-making. The calculation tasks are performed locally and unloaded to the edge calculation server, which are represented by 0 and 1 respectively. Each node has limited computing power but can compute its own tasks. The edge computing server can perform computing tasks, and it is assumed that its performance can be as large as possible, which is larger than the calculation amount of any node but smaller than the total calculation capacity of all nodes. Base station adopts centralized edge computing unloading strategy, which plays a scheduling role in edge computing. This paper assumes that the computing power is large enough, the scheduling queue is small, and the scheduling time can be ignored. As a decision-maker, the base station decides the calculation execution right of the node. When calculating the time delay, because the return time delay is very small, it can be ignored. The parameters set in the experiment are shown in the following table.

Simulation Results
In this experiment, the standard deviation of individual fitness in the population of genetic algorithm changes with the population evolution algebra as shown in the figure, and the individual fitness includes time delay and energy consumption. The blue dotted line indicates that the standard deviation of time delay changes with the population evolution algebra, and the red solid line indicates that the standard deviation of energy consumption changes with the population evolution algebra. In the early stage of population evolution, the standard deviation of time delay and energy consumption fluctuated greatly and became stable after 35 generations. The evolution algebra selected in this experiment is 500 generations. If the results of NSGA-II and random method are considered, see the figure below. The red point set represents the decision result of NSGA-II, and the black point set represents the decision result of random method. According to the above rules, the black point sets are all in the upper right of the red point set, which means that the result of NSGA-II algorithm is better than that of random method.
Consider introducing a ray from the origin in the first quadrant, which starts from the origin and passes through the red point set and the black point set, as shown in the following figure. The graph is equivalent to the figure above, but the representation method is different. As a result, the closer to the origin (that is, the closer to the left) the better the result. If the time series passing through the point set is used, the earlier the ray passes through the point, the better the result will be. Through the analysis, it can be concluded that the red points are all on the lower left side of the black point set, which is closer to the origin or the ray passes through earlier than the black point set, and the result of the red point set is better.  In this experiment, we consider using NSGA-II and tournament algorithm to get the decision results of time delay and energy consumption in the selection process. The results are compared as shown in the figure below. The red dot indicates that the NSGA-II selection method is used in the selection process, and the green dot indicates that the Tournament method is used. The results are presented in the form of dots and distributed in the region discretely. Through the analysis, when closer to the time delay has a greater impact on the decision results, the results of NSGA-II are distributed in a wider range, and closer to the side of energy consumption, which means that the use of NSGA-II in the selection process can make us get a wider range of optimal solutions. In the same way, similar analysis results appear in the case that the closer energy consumption has a greater impact on the decision results. This characteristic reflects that NSGA-II considers the comprehensive influence of multiobjective, rather than one or several of them dominating. To sum up, the experiments show that, compared with the multi-objective optimization method of stochastic method, the unloading decision of NSGA-II can achieve the best. The results of NSGA-II can be distributed in a wider range than that of common tournament selection methods.

Conclusion
In this paper, we propose an edge computing offload method of power Internet of things based on multi-objective genetic algorithm NSGA-II. First, in the edge computing scenario of simple power Internet of things, we analyze the computing offload problem model under the condition of time division multiplexing. Then, aiming at the target of energy consumption and time delay of terminal equipment, we use NSGA-II to make the decision of edge computing offloading. This method mainly considers multi-objective optimization to carry out effective computing offloading and resource allocation, as well as energy consumption and time delay of terminal equipment. Finally, we performed a simple simulation experiment. The results of single objective optimization and multi-objective optimization are compared. The results show that the optimal unloading can be achieved by considering both energy consumption and time delay. Advantage comparison is shown in Table 2.
But there are still some problems in this paper. First of all, choosing 500 generations in the genetic algebra setting of genetic algorithm wastes computing resources to a certain extent. Then, the multi-objective optimization problem of genetic algorithm is essentially a search problem without self learning ability, which is also needed in the target optimization problem of computational offload. Finally, the setting of the experimental scene is relatively simple, without considering the more complex scene.