# Differential Games of Rechargeable Wireless Sensor Networks against Malicious Programs Based on SILRD Propagation Model

Authors: Guiyun Liu; Baihao Peng; Xiaojing Zhong; Xuejing Lan
Journal: Complexity
 (2020)

---

## Abstract

Based on the traditional propagation model, this paper innovatively divides nodes into high- and low-energy states through introducing Low-energy (L) state and presents a whole new propagation model which is more suitable for WSNs (wireless sensor networks) against malicious programs, namely, SILRD (Susceptible, Infected, Low-energy, Recovered, Dead) model. In this paper, nodes are divided into five states according to the residual energy and infection level, and the differential equations are constructed to describe the evolution of nodes. At the same time, aiming at the exhaustion of WSNs’ energy, this paper introduces charging as a method to supplement the energy. Furthermore, we regard the confrontation between WSNs and malicious programs as a kind of game and find the optimal strategies by using the Pontryagin Maximum Principle. It is found that charging as a defense mechanism can inhibit the spread of malicious programs and reduce overall costs. Meanwhile, the superiority of bang-bang control on the SILRD model is highlighted by comparing with square control.


---

## Body

## 1. Introduction

WSNs consist of a series of energy-limited nodes with monitoring, receiving, transmitting, and other functions that act as connections between surrounding environment and control centers or computers for further process. As WSNs have gradually penetrated into every aspect of our daily life, they have become an indispensable part of us, including environmental monitoring, medical care, and vehicle tracking [1].However, the shortcomings of WSNs are increasingly exposed, such as vulnerability to malicious programs and limited battery capacity. Due to the similarity of transmission mechanism, the propagation of malicious programs in WSNs can be modeled by imitating the theory of epidemiology. After decades of research studies of the initial SIR (Susceptible, Infected, Removed) model proposed by Kephart and White [2], the epidemiological model has been fully developed [3–6].Many scholars are also devoted to the study of malicious programs’ propagation mechanism in WSNs. In order to better protect against worm theft of security-critical information, Haixia Peng et al. proposed a reliability-oriented local-area model, which considers the topology of WSNs [7]. Based on the actual scenario, Akansha Singh et al. proposed a mathematical model that considered the influence of node distribution density and different communication radius on worm propagation [8]. Mohammad Sayad Haghighi et al. proposed a dynamic propagation model with the consideration of geospatial limitation [9]. Shakya [10] and Bahi et al. [11] have even considered the spatial correlations in WSNs. Bo Qu and Wang added nodal degree into the model as a factor affecting the infection rates [12]. The sleep and work interleaving policy was incorporated in a multiworm propagation model proposed by [13]. Tang also introduced sleep pattern to enhance the defense of WSNs [14]. In mobile WSNs, the operations of providing pulse immunization to susceptible nodes can well resist the propagation of malware [15]. Compared with static defensive measures, mobile patching is more effective in suppressing the spread of mobile sensor worms [16]. Nicola Roberto Zema et al. also used a mobile approach to repair WSNs [17]. By adding time delay to the propagation model, Neha Keshri et al. found it could reduce the damage to nodes [18]. Many scholars have considered the energy problem of WSNs, for example, Lei Mo et al. introduced a mobile charger to add energy to the networks [19]. However, it is not difficult to find that the nodal energy is basically not taken into account in the classification criteria of different states of nodes. One of the highlights of this paper is that the energy of nodes has been put forward and divided into high- and low-energy state further. At the same time, the SILRD (Susceptible, Infected, Low-energy, Recovered, Dead) model is proposed in this paper according to the nodal states.As it is a problem of antagonism against malicious programs, some of the scholars also used game theory to get the optimal strategy in the nonlinear system. By reducing the transmission range to suppress the spread of malicious programs, M. H. R. Khouza-ni et al. obtained the optimal transmission range by constructing the optimal control model [20] and also considered bandwidth consumption and invasion risk as an optimal problem [21]. Mohamed S. Abdalzaher and Osamu Muta proposed a Stackelberg game approach to improve the defense mechanisms of WSNs against the spectrum sensing data falsification attack [22]. As a study of nonlinear systems, Chenglong Wang et al. studied the problem of online adaptive optimal controller with input time delays [23]. Shuping He et al. proposed a scheme of online H∞ control laws for nonlinear systems [24]. Chengcheng Ren et al. designed a suitable distributed controller [25] and a suitable finite-time stabilizable controller [26] to guarantee the positiveness and stabilization of the closed-loop systems. As an inseparable part of game theory, differential game has advantages in dealing with dynamic problems. Miao and Li exploited differential game to construct the optimal problem between network systems and attackers [27]. Miao figured out the optimum between throughput and energy efficiency [28]. Dong HAO and Kouichi SAKURAI defined a game called PUE attack game between attackers and secondary users [29]. Ding et al. constructed a differential game between two types of nodes in WSNs [30]. In addition to various game theories, Shuping He et al. also used reinforcement learning [31] and policy iteration algorithm [32] to solve the problem of optimal control. Differential game can also solve different kinds of problems: multiagent collision prevention [33], multipath routing optimization [34], optimal storage capacities [35], and minimization of transmission cost [36]. At the same time, linear programming can also be used to find the optimal solution [37]. In this paper, the optimal dynamic game strategies between the malicious programs and WSNs are obtained by using Pontryagin’s Maximum Principle.Our contributions are summarized below.First, an improvement on the basic epidemiological model has been proposed. Considering the energy storage of WSNs, the low-energy state to further satisfy the feature of WSNs has been introduced. In the actual situation, nodes will consume their energy as a result of daily work, and they will definitely undergo a process from full energy to low energy. Meanwhile, since the attack of some malicious programs will be embodied in the faster consumption of energy, the introduction of low-energy state can reflect the attack degree to some extent.Second, the effect of rechargeable factor on WSNs has been considered. In order to maintain the normal function of WSNs, the rechargeable factor is introduced. As one of the main defects of WSNs, limited energy has been restricted the lifetime of WSNs, for nodes, which are infected by a certain kind of malicious programs, can consume energy quickly. Thus, the influence of malicious programs can be suppressed by charging. As the number of low-energy nodes decreases, the cost of WSNs’ operation increases by deploying UAVs. Therefore, this paper will reveal the balance between the two. At the same time, the validity of the control method in the SILRD model is further explained.The rest of our paper is organized as follows. In Section2, SILRD model with low-energy state has been proposed. At the same time, the influence of rechargeable factors on WSNs is considered and the corresponding differential equations are formulated. In Section 3, differential game has been used to figure out optimal strategies applied by WSNs and malicious programs. In Section 4, the evolution of nodal states, the flow of nodal energy, and the games between WSNs and malicious programs will be revealed by simulation. In Section 5, a conclusion of the full paper is presented here.


## 2. SILRD Model with WSNs

In WSNs, the total number of identical and static nodes isN and they are distributed randomly in a flat area with S (m2). Each node is equipped with an antenna for messaging and a receiver for wireless charging. The maximum radius of node’s transmission is r (m). In this section, the SILRD model will be proposed, and the differential equations will dynamically reflect the transition of nodal states.


### 2.1. Nodal States in WSNs

At the same time, charging is happening all the time in WSNs. This model assumes the attack from only one type of malicious program, that is, the recovered nodes will not be repeatedly infected. Each node transmits information to their surrounding nodes, which will relay the information to remote computer or control center step by step. Malicious programs propagate through information transmission between nodes. Once infected with malicious programs, the nodes will consume their energy at a faster rate.Based on the traditional model, the SILRD model further considers energy level of each nodes and classifies nodes into the following five states:Susceptible (S) : a node in the Susceptible state is extremely vulnerable to malicious programs because of its lack of defenses. Energy consumption level of these nodes is normal.Infected (I) : a node in the Infected state has a rapid increase in energy consumption due to the successful infection of malicious programs. If infected nodes are not patched or charged in time, they will die of exhaustion.Low-energy (L) : nodes in the Low-power state are those that are infected with malicious programs or that consume energy normally. These nodes are characterized by low-energy level so that they cannot maintain normal work, including data transmission between nodes.Recovered (R) : a node in the Recovered state is immune to malicious programs. Particularly, charging and patching occur at the same time. In other words, nodes in recovered state are possessing not only immunity but also a high-energy level.Dead (D) : a node in the Dead state is completely dysfunctional. Even charging such a node cannot restore it. Meanwhile, this part of nodes due to total loss of energy is unable to infect its neighbors.In this paper,S(t), I(t), R(t), L(t), and D(t) are the ratio of susceptible, infected, recovered, low-energy, and dead nodes at time t, respectively. The sum of these five ratios is equal to 1. Thus, the following equation must be satisfied:(1)St+It+Rt+Dt+Lt=1.


### 2.2. Transitions between Nodal States in SILRD Model

Before the game started, only susceptible nodes and infected nodes existed in WSNs, and their sum is equal toN. Furthermore, the death of nodes because of hardware damage or environmental factors have not been considered in this paper.The transmission range of each node isπr2m2. The density of susceptible nodes in WSNs is St/S. For an infected node, the number of susceptible nodes around which it can infect is πr2St/S. Therefore, in whole WSNs, the number of susceptible nodes infected by malicious programs is πr2ItSt/S.In this model, the number of sensor nodes does not increase. Before WSNs were not infected by malicious programs, nodes in WSNs normally collect different kinds of environmental information and transmit the processed messages to their surrounding nodes. Malicious programs are artificially implanted into WSNs. Besides destroying the functionality of nodes, malicious programs can eavesdrop on information through transmission between nodes. In the absence of rechargeable devices, nodes will eventually shut down as the power runs out.It is necessary to charge WSNs because of the consumption of electricity caused by normal work and the attack by malicious programs. Infected nodes spread malicious programs to neighbors with a certain probability. Susceptible nodes which receive malicious programs and get infectivity will become infected nodes. Some susceptible nodes have not been infected by malicious programs during their lifetime and remain in the normal working state. This part of the nodes will be transferred directly from the susceptible state to low-energy state without recharging by UAVs (Unmanned Aerial Vehicles) or the other MCs (Moving Chargers). Some susceptible nodes will gain immunity to this type of malicious programs in time by receiving and installing patches from the UAVs. The rest of susceptible nodes will keep staying into the normal state. Specifically, two simple schematic diagrams of the scene of the SILRD model have also been portrayed, and the states evolutions of nodes covered during the UAV movement are clearly visible, as depicted in Figure1.Figure 1
Evolution of nodal states in UAV coverage area. (a) The location of the UAV at a certain moment and the nodal states before UAV moves. (b) The evolution of Nodal states as a result of the UAV moving with the desired trajectory from the original position.
(a)(b)The transmission capacity of malicious programs directly determines the number of nodes transmit from the susceptible state to infected state. Infected nodes dissipate their own energy by enhancing the frequency of information acquisition and the strength of communication with surrounding nodes. With the increasing damage degree of malicious programs, nodes will enter into the dead state at a faster speed. At the same time, malicious programs can also choose not to continue to attack the infected nodes, and these infected nodes are only infectious but not destructive. However, if the patches carried by UAVs are timely and successfully installed early, the nodes will safely convert to the recovered state.Nodes in the recovered state are not only immune to the malicious programs but also in a high-energy level. Nodes that move from susceptible and infected states to recovered states are in high-energy level, and UAVs only need to transmit patches without charging them. On the contrary, nodes in the low-energy state need to be charged and patched at the same time to transform to the recovered state, even if the nodes in the recovered state shift to the low-energy state without energy replenishment due to normal consumption.Some of the nodes in the low-energy state are immune, while others are not. Nodes in the low-energy state will exhaust quickly, and the effect of malicious programs on nodes transmitting from the low-energy state to dead state has been ignored. The flow diagram of the SILRD propagation model is shown in Figure2.Figure 2
The flow diagram of the propagation model. The letters in the circle represent the corresponding state of the node. Arrows indicate the direction of transition between node states.The transition probability from the susceptible state to infected state due to being infected by malicious programs isPSI. The probability of the susceptible nodes moves from the high-energy level to low-energy level due to normal operation is PSL. Probability of susceptible nodes being patched by UAVs is PSR. The probability that infected nodes will be repaired while still at high-energy level is PIR. The probability that infected nodes are destroyed by malicious programs and squander energy until exhaustion is PID. Malicious programs in some infected nodes stop destroying, at this time, these infected nodes can work normally with probability PIL at the low-energy state. The probability of nodes at the low-energy level being successfully charged and patched by UAVs before they run out of energy is PLR. The probability of immune nodes entering the low-energy level due to daily collection and transmission is PRL. Finally, the probability of death due to exhaustion at the low-energy level is PLD. The rate of change in each state is formulated from(2)dStdt=−PSIπr2StItS−PSRSt−PSLSt,(3)dItdt=PSIπr2StItS−PIRIt−PILIt−PIDIt,(4)dLtdt=PILIt+PSLSt−PLRLt−PLDLt+PRLRt,(5)dRtdt=PIRIt+PSRSt+PLRLt−PRLRt,(6)dDtdt=PLDLt+PIDIt.


### 2.3. The Introduction of Control Variables

In this paper, the damage caused by malicious programs to WSNs is mainly reflected in the conversion process from the infected state to dead state. At the same time, the propagation ability of malicious programs depends not only on the transmission frequency between nodes but also on themselves. Therefore, attack modes of malicious programs include the destruction of WSNs and their propagation.The defense measures of WSNs are embodied in charging and patching various nodes. Charging nodes in different types of states by UAVs can not only prolong the lifespan of WSNs but also mitigate the damage from malicious programs to some degree. Patching a node can make it immune to the corresponding malicious programs. Thus, the defense patterns of WSNs are manifested in the supplement of node electricity and the provision of relevant patches.According to the effects of the attack and defense measures on nodal states, two hypotheses have been proposed. One is thatPSI and PID are controlled by malicious programs to some degree. The higher the attack level of the malicious programs, the higher these two probabilities. The other is that PSR, PIR, and PLR are controlled by WSNs to some degree. Similarly, the higher the defense level of WSNs, the higher the probability of all three.To further formulate this five transition probabilities, equation (7) has been put forward:(7)PSI=ASILSIASImax+ASImin,PID=AIDLIDAIDmax+AIDmin,PSR=DSRLSRDSRmax+DSRmin,PIR=DIRLIRDIRmax+DIRmin,PLR=DLRLLRDLRmax+DLRmin,where ASI and AID represent the control levels of malicious programs, while LSI and LIL represent the probability of successful attack by malicious programs. In the same way, DSR, DLR, and DIR represent the control level of WSNs, while LSR, LIR, and LLR represent the probability of successful defense. ASImin and ASImax represent the minimum and maximum values of malicious program’s control level, respectively, so do the other counterparts in equation (7).The success rates of infection and suppression are all on a scale of 0 to 1, as shown below:(8)LSI,LID,LSR,LIR,LLR∈0,1.


## 2.1. Nodal States in WSNs

At the same time, charging is happening all the time in WSNs. This model assumes the attack from only one type of malicious program, that is, the recovered nodes will not be repeatedly infected. Each node transmits information to their surrounding nodes, which will relay the information to remote computer or control center step by step. Malicious programs propagate through information transmission between nodes. Once infected with malicious programs, the nodes will consume their energy at a faster rate.Based on the traditional model, the SILRD model further considers energy level of each nodes and classifies nodes into the following five states:Susceptible (S) : a node in the Susceptible state is extremely vulnerable to malicious programs because of its lack of defenses. Energy consumption level of these nodes is normal.Infected (I) : a node in the Infected state has a rapid increase in energy consumption due to the successful infection of malicious programs. If infected nodes are not patched or charged in time, they will die of exhaustion.Low-energy (L) : nodes in the Low-power state are those that are infected with malicious programs or that consume energy normally. These nodes are characterized by low-energy level so that they cannot maintain normal work, including data transmission between nodes.Recovered (R) : a node in the Recovered state is immune to malicious programs. Particularly, charging and patching occur at the same time. In other words, nodes in recovered state are possessing not only immunity but also a high-energy level.Dead (D) : a node in the Dead state is completely dysfunctional. Even charging such a node cannot restore it. Meanwhile, this part of nodes due to total loss of energy is unable to infect its neighbors.In this paper,S(t), I(t), R(t), L(t), and D(t) are the ratio of susceptible, infected, recovered, low-energy, and dead nodes at time t, respectively. The sum of these five ratios is equal to 1. Thus, the following equation must be satisfied:(1)St+It+Rt+Dt+Lt=1.


## 2.2. Transitions between Nodal States in SILRD Model

Before the game started, only susceptible nodes and infected nodes existed in WSNs, and their sum is equal toN. Furthermore, the death of nodes because of hardware damage or environmental factors have not been considered in this paper.The transmission range of each node isπr2m2. The density of susceptible nodes in WSNs is St/S. For an infected node, the number of susceptible nodes around which it can infect is πr2St/S. Therefore, in whole WSNs, the number of susceptible nodes infected by malicious programs is πr2ItSt/S.In this model, the number of sensor nodes does not increase. Before WSNs were not infected by malicious programs, nodes in WSNs normally collect different kinds of environmental information and transmit the processed messages to their surrounding nodes. Malicious programs are artificially implanted into WSNs. Besides destroying the functionality of nodes, malicious programs can eavesdrop on information through transmission between nodes. In the absence of rechargeable devices, nodes will eventually shut down as the power runs out.It is necessary to charge WSNs because of the consumption of electricity caused by normal work and the attack by malicious programs. Infected nodes spread malicious programs to neighbors with a certain probability. Susceptible nodes which receive malicious programs and get infectivity will become infected nodes. Some susceptible nodes have not been infected by malicious programs during their lifetime and remain in the normal working state. This part of the nodes will be transferred directly from the susceptible state to low-energy state without recharging by UAVs (Unmanned Aerial Vehicles) or the other MCs (Moving Chargers). Some susceptible nodes will gain immunity to this type of malicious programs in time by receiving and installing patches from the UAVs. The rest of susceptible nodes will keep staying into the normal state. Specifically, two simple schematic diagrams of the scene of the SILRD model have also been portrayed, and the states evolutions of nodes covered during the UAV movement are clearly visible, as depicted in Figure1.Figure 1
Evolution of nodal states in UAV coverage area. (a) The location of the UAV at a certain moment and the nodal states before UAV moves. (b) The evolution of Nodal states as a result of the UAV moving with the desired trajectory from the original position.
(a)(b)The transmission capacity of malicious programs directly determines the number of nodes transmit from the susceptible state to infected state. Infected nodes dissipate their own energy by enhancing the frequency of information acquisition and the strength of communication with surrounding nodes. With the increasing damage degree of malicious programs, nodes will enter into the dead state at a faster speed. At the same time, malicious programs can also choose not to continue to attack the infected nodes, and these infected nodes are only infectious but not destructive. However, if the patches carried by UAVs are timely and successfully installed early, the nodes will safely convert to the recovered state.Nodes in the recovered state are not only immune to the malicious programs but also in a high-energy level. Nodes that move from susceptible and infected states to recovered states are in high-energy level, and UAVs only need to transmit patches without charging them. On the contrary, nodes in the low-energy state need to be charged and patched at the same time to transform to the recovered state, even if the nodes in the recovered state shift to the low-energy state without energy replenishment due to normal consumption.Some of the nodes in the low-energy state are immune, while others are not. Nodes in the low-energy state will exhaust quickly, and the effect of malicious programs on nodes transmitting from the low-energy state to dead state has been ignored. The flow diagram of the SILRD propagation model is shown in Figure2.Figure 2
The flow diagram of the propagation model. The letters in the circle represent the corresponding state of the node. Arrows indicate the direction of transition between node states.The transition probability from the susceptible state to infected state due to being infected by malicious programs isPSI. The probability of the susceptible nodes moves from the high-energy level to low-energy level due to normal operation is PSL. Probability of susceptible nodes being patched by UAVs is PSR. The probability that infected nodes will be repaired while still at high-energy level is PIR. The probability that infected nodes are destroyed by malicious programs and squander energy until exhaustion is PID. Malicious programs in some infected nodes stop destroying, at this time, these infected nodes can work normally with probability PIL at the low-energy state. The probability of nodes at the low-energy level being successfully charged and patched by UAVs before they run out of energy is PLR. The probability of immune nodes entering the low-energy level due to daily collection and transmission is PRL. Finally, the probability of death due to exhaustion at the low-energy level is PLD. The rate of change in each state is formulated from(2)dStdt=−PSIπr2StItS−PSRSt−PSLSt,(3)dItdt=PSIπr2StItS−PIRIt−PILIt−PIDIt,(4)dLtdt=PILIt+PSLSt−PLRLt−PLDLt+PRLRt,(5)dRtdt=PIRIt+PSRSt+PLRLt−PRLRt,(6)dDtdt=PLDLt+PIDIt.


## 2.3. The Introduction of Control Variables

In this paper, the damage caused by malicious programs to WSNs is mainly reflected in the conversion process from the infected state to dead state. At the same time, the propagation ability of malicious programs depends not only on the transmission frequency between nodes but also on themselves. Therefore, attack modes of malicious programs include the destruction of WSNs and their propagation.The defense measures of WSNs are embodied in charging and patching various nodes. Charging nodes in different types of states by UAVs can not only prolong the lifespan of WSNs but also mitigate the damage from malicious programs to some degree. Patching a node can make it immune to the corresponding malicious programs. Thus, the defense patterns of WSNs are manifested in the supplement of node electricity and the provision of relevant patches.According to the effects of the attack and defense measures on nodal states, two hypotheses have been proposed. One is thatPSI and PID are controlled by malicious programs to some degree. The higher the attack level of the malicious programs, the higher these two probabilities. The other is that PSR, PIR, and PLR are controlled by WSNs to some degree. Similarly, the higher the defense level of WSNs, the higher the probability of all three.To further formulate this five transition probabilities, equation (7) has been put forward:(7)PSI=ASILSIASImax+ASImin,PID=AIDLIDAIDmax+AIDmin,PSR=DSRLSRDSRmax+DSRmin,PIR=DIRLIRDIRmax+DIRmin,PLR=DLRLLRDLRmax+DLRmin,where ASI and AID represent the control levels of malicious programs, while LSI and LIL represent the probability of successful attack by malicious programs. In the same way, DSR, DLR, and DIR represent the control level of WSNs, while LSR, LIR, and LLR represent the probability of successful defense. ASImin and ASImax represent the minimum and maximum values of malicious program’s control level, respectively, so do the other counterparts in equation (7).The success rates of infection and suppression are all on a scale of 0 to 1, as shown below:(8)LSI,LID,LSR,LIR,LLR∈0,1.


## 3. Optimal Dynamic Game Strategies for the Malicious Programs and WSNs

As an important branch of game theory, differential game is the theory which both parties can make decisions freely proposed by Isaac in solving the pursuit evasion problem in 1965 [38]. Differential game refers to the game played by multiple players in a continuous time system. At the same time, players in the system try to optimize their independent and ambivalent goals and finally obtain the optimal strategies of the players over time. Generally speaking, differential game is a theory to study the decision-making process of two or more players when their controls are applied to a dynamical system described by differential equations. In the differential game, figuring out a saddle point is the same thing as finding out Nash equilibrium. In this section, the cost of the game is formulated by further description of the flow diagram, and the optimal dynamic strategies of both sides of the game are constructed according to Pontryagin’s Maximum Principle.


### 3.1. Payoff Function in the Attack-Defense Game

In this paper, the zero-sum noncooperative differential game between malicious programs and WSNs has been discussed. The goal of malicious programs is to maximize the payoff while the networks want to minimize it. After analysis by Pontriagin’s Maximum Principle, the optimal attack strategy for malicious programs has been obtained, and WSNs also have the corresponding optimal countermeasures.Definition 1.
Given a fixed duration T,νt = (ASIt, AIDt) is a strategy set of malicious programs at time t. Identically, μt = (DSRt, DIRt, DLRt) is a strategy set of WSNs at time t.
In addition to the costs cause by malicious programs’ attack, WSNs themselves will generate a variety of costs with time.
Nodes in the infected state, by destroying the transmission mechanism between nodes, lose plenty of their own energy and bring to a certain cost. Moreover, such nodes also cause unexpected losses through eavesdropping on WSNs. Although nodes in the low-energy state do not have the ability to propagate malicious programs, they cannot work normally due to the low-energy level, which will definitely engender much losses. As a result of complete loss of function of the dead node, topological structure of WSNs will be disrupted. In the reconstruction of the new transmission mechanism, it is bound to incur additional costs. Multiple UAVs charge or patch corresponding nodes by carrying patches and energy to some area of WSNs. During the flight of the UAVs, a part of electricity will be consumed, and it will be consumed in the process of SWIPT (simultaneous wireless information and power transfer) of UAVs.
While malicious programs create networks’ losses, WSNs’ own defense measures will make up for this losses. The purpose of malicious programs is to make them as greater as possible, whereas WSNs do the opposite, thus forming two sides of the game.
By patching susceptible nodes, they will be immune to some malicious programs, which ensures normal operation of WSNs in the future. The infected node returns to the normal state, which not only reduces the loss that should have occurred but also guarantees the normal operation for a period of time. In addition to the low-energy levels, nodes in the low-energy state are likely to contain more malicious programs. Therefore, it should not only be replenished with energy but also be patched to make it immune.
The risk posed by infected nodes spreading malicious programs isCIIt at time t, where CI is a cost coefficient and CI≥0. The consumption caused by using UAVs to repair nodes while replenishing the node energy is CLRPLRLt at time t, where CLR≥0. The cost of losing some functions due to nodes at low-energy levels is CLLt at time t, where CL≥0. Loss of WSNs’ failure due to nodes death is CDDt at time t, where CD≥0. Nodes have positive benefits CRRt at time t due to having immunity, where CR≥0. The costs of patching susceptible and infected nodes are CSRPSRSt and CIRPIRIt at time t, respectively, where CSR≥0 and CIR≥0. Nodes in the susceptible state have CSSt benefit from working normally at time t, where CS≥0. At the terminal moment, susceptible and recovered nodes will bring future benefits, so CSfStf and CRfRtf will be used to measure these benefits, where CSf≤0 and CRf≤0. Conversely, nodes in the infected, low-energy, and dead states will continue to affect the networks. CIfItf, CLfLtf, and CDfDtf will be used to describe these costs, where CIf≥0, CLf≥0, and CDf≥0.
The payoff function of this game is shown in(9)Jμt,νt=∫t0tf−CSSt+CI+CILPIL+CPATCHPIRIt−CRRt+CDDt+CLRPLR+CLLt+CPATCHPSRStdt+CSfStf+CIfItf+CPATCHPSRStdt+CSfStf+CIfItf.
According to the payoff function, we haveϕ to determine terminal constraint of the game, as depicted in the following equation:(10)ϕ=CSfStf+CIfItf+CLfLtf+CRfRtf+CDfDtf.


### 3.2. Optimal Dynamic Strategies in the Attack-Defense Game

Theorem 1.
In the Attack-Defense game in theSILRD model, the optimal dynamic strategies of malicious programs and WSNs are(11)ASI∗=ASImax,βSI>0,unknown,βSI=0,ASImin,βSI<0,AID∗=AIDmax,βID>0,unknown,βID=0,AIDmin,βID<0,DSR∗=DSRmin,βSR>0unknown,βSR=0,DSRmax,βSR<0,DIR∗=DIRmin,βIR>0,unknown,βIR=0,DIRmax,βIR<0,DLR∗=DLRmin,βLR>0,unknown,βLR=0,DLRmax,βLR<0,where βSI, βID, βSR, βIR, and βLR satisfy the following equation:(12)βSI=λIt−λStπr2LSIStIt/SASImax+ASImin,βID=λDt−λItLIDItAIDmax+AIDmin,βSR=λRt−λSt+CPATCHLSRStDSRmax+DSRmin,βIR=λRt−λIt+CPATCHLIRItDIRmax+DIRmin,βLR=λRt−λLt+CLRLLRLtDLRmax+DLRmin.Proof.
According to (2)–(6) and (8), we can construct the Hamiltonian function as shown below:(13)H=λStStdt+λItItdt+λLtLtdt+λRtRtdt+λDtDtdt−CSSt+CIIt−CRRt+CLLt+CDDt−CLRPLRLt−CIRPIRIt+CSRPSRSt.
From state functions (2)–(6) and payoff function (8), the following characteristics have been found out:1
The five state functions and the payoff function are all continuous in time2
The control variables are all bounded and continuous in the state functions and payoff function
Thus, there must exist a saddle pointμ∗t,ν∗t that meets (14) according to [39]:(14)Jμ∗t,νt≤Jμ∗t,ν∗t≤Jμ∗t,ν∗t,where Jμ∗t,νt represents the cost incurred when only the optimal strategy is selected by WSNs. Jμ∗t,νt also denotes that only malicious programs choose the optimal strategy. Jμ∗t,νt indicates that not only the networks choose the optimal strategy but also malicious programs choose the optimal strategy.
According to [40] and the characteristics of this model, there must be a V satisfying(15)V=maxνtminμtJμt,νt=minμtmaxνtJμt,νt=Jμ∗t,ν∗t,where maxνtminμtJμt,νt represents the cost incurred by WSNs in selecting the optimal strategy after the malicious programs makes optimal decision, while minμtmaxνtJμt,νt denotes the cost incurred when the order of two sides is switched.
The following co-state differential equations (16)–(20) determine the co-state variables λSt, λIt, λRt, λLt, and λDt, which are all time dependent:(16)dλStdt=−dHdSt=λSt−λItπr2I∗tASI∗LSIASImax+ASIminS+CS−CPATCHDSR∗LSRDSRmax+DSRmin+λSt−λLtPSL+λSt−λRtDSR∗LSRDSRmax+DSRmin,(17)dλStdt=−dHdIt=λSt−λItπr2S∗tASI∗LSIASImax+ASIminS−CI+λIt−λRtDIR∗LIRDIRmax+DIRmin−CPATCHDIR∗LIRDIRmax+DIRmin+λIt−λLtPIL+λIt−λDtAID∗LID,(18)dλL∗tdt=−dHdLt=λLt−λRtDLR∗LLRDLRmax+DLRmin+λLt−λDtPLD−CL−CLRDLR∗LLRDLRmax+DLRmin,(19)dλR∗tdt=−dHdRt=λLt−λRtPRL+CR,(20)dλD∗tdt=−dHdDt=−CD.
Meanwhile, the terminal value of the co-state variables satisfies(21)λStf=dϕdSt=CSf,λItf=dϕdIt=CIf,λLtf=dϕdLt=CLf,λRtf=dϕdRt=CRf,λDtf=dϕdDt=CDf.
According to Pontryagin’s Maximum Principle, whenλIt−λStπr2LSIStIt/S/ASImax+ASImin is greater than 0, the malicious programs will choose the maximum control ASImax in order to make the cost as large as possible. On the contrary, supposing λIt−λStπr2LSIStIt/S/ASImax+ASImin is less than 0, the malicious programs will choose the minimum control ASImax to maximize the cost. Similarly, when λDt−λItLIDIt/AIDmax+AIDmin is greater than 0, the malicious programs will choose AIDmax, and the malicious programs will choose AIDmin if λDt−λItLIDIt/AIDmax+AIDmin is less than 0.
For WSNs, in caseλRt−λSt+CPATCHLSRSt/DSRmax+DSRminis greater than 0, it will adopt the minimum control DSRmin to make the cost as small as possible. Maximum control DSRmax is taken to minimize the cost, when λRt−λSt+CPATCHLSRSt/DSRmax+DSRminis less than 0. In terms of restoration measures for infected nodes, if λRt−λIt+CPATCHLIRIt/DIRmax+DIRminis greater than 0, WSNs will choose the minimum control DIRmin, while WSNs will choose the maximum control DIRmax when λRt−λIt+CPATCHLIRIt/DIRmax+DIRmin is less than 0. WSNs also takes similar measures to nodes moving from the low-energy state to recovered state. The node will take the maximum control DLRmax supposing λRt−λLt+CLRLLRLt/DLRmax+DLRminis less than 0, while the node will take the minimum control DLRmin if λRt−λLt+CLRLLRLt/DLRmax+DLRminis greater than 0.


## 3.1. Payoff Function in the Attack-Defense Game

In this paper, the zero-sum noncooperative differential game between malicious programs and WSNs has been discussed. The goal of malicious programs is to maximize the payoff while the networks want to minimize it. After analysis by Pontriagin’s Maximum Principle, the optimal attack strategy for malicious programs has been obtained, and WSNs also have the corresponding optimal countermeasures.Definition 1.
Given a fixed duration T,νt = (ASIt, AIDt) is a strategy set of malicious programs at time t. Identically, μt = (DSRt, DIRt, DLRt) is a strategy set of WSNs at time t.
In addition to the costs cause by malicious programs’ attack, WSNs themselves will generate a variety of costs with time.
Nodes in the infected state, by destroying the transmission mechanism between nodes, lose plenty of their own energy and bring to a certain cost. Moreover, such nodes also cause unexpected losses through eavesdropping on WSNs. Although nodes in the low-energy state do not have the ability to propagate malicious programs, they cannot work normally due to the low-energy level, which will definitely engender much losses. As a result of complete loss of function of the dead node, topological structure of WSNs will be disrupted. In the reconstruction of the new transmission mechanism, it is bound to incur additional costs. Multiple UAVs charge or patch corresponding nodes by carrying patches and energy to some area of WSNs. During the flight of the UAVs, a part of electricity will be consumed, and it will be consumed in the process of SWIPT (simultaneous wireless information and power transfer) of UAVs.
While malicious programs create networks’ losses, WSNs’ own defense measures will make up for this losses. The purpose of malicious programs is to make them as greater as possible, whereas WSNs do the opposite, thus forming two sides of the game.
By patching susceptible nodes, they will be immune to some malicious programs, which ensures normal operation of WSNs in the future. The infected node returns to the normal state, which not only reduces the loss that should have occurred but also guarantees the normal operation for a period of time. In addition to the low-energy levels, nodes in the low-energy state are likely to contain more malicious programs. Therefore, it should not only be replenished with energy but also be patched to make it immune.
The risk posed by infected nodes spreading malicious programs isCIIt at time t, where CI is a cost coefficient and CI≥0. The consumption caused by using UAVs to repair nodes while replenishing the node energy is CLRPLRLt at time t, where CLR≥0. The cost of losing some functions due to nodes at low-energy levels is CLLt at time t, where CL≥0. Loss of WSNs’ failure due to nodes death is CDDt at time t, where CD≥0. Nodes have positive benefits CRRt at time t due to having immunity, where CR≥0. The costs of patching susceptible and infected nodes are CSRPSRSt and CIRPIRIt at time t, respectively, where CSR≥0 and CIR≥0. Nodes in the susceptible state have CSSt benefit from working normally at time t, where CS≥0. At the terminal moment, susceptible and recovered nodes will bring future benefits, so CSfStf and CRfRtf will be used to measure these benefits, where CSf≤0 and CRf≤0. Conversely, nodes in the infected, low-energy, and dead states will continue to affect the networks. CIfItf, CLfLtf, and CDfDtf will be used to describe these costs, where CIf≥0, CLf≥0, and CDf≥0.
The payoff function of this game is shown in(9)Jμt,νt=∫t0tf−CSSt+CI+CILPIL+CPATCHPIRIt−CRRt+CDDt+CLRPLR+CLLt+CPATCHPSRStdt+CSfStf+CIfItf+CPATCHPSRStdt+CSfStf+CIfItf.
According to the payoff function, we haveϕ to determine terminal constraint of the game, as depicted in the following equation:(10)ϕ=CSfStf+CIfItf+CLfLtf+CRfRtf+CDfDtf.


## 3.2. Optimal Dynamic Strategies in the Attack-Defense Game

Theorem 1.
In the Attack-Defense game in theSILRD model, the optimal dynamic strategies of malicious programs and WSNs are(11)ASI∗=ASImax,βSI>0,unknown,βSI=0,ASImin,βSI<0,AID∗=AIDmax,βID>0,unknown,βID=0,AIDmin,βID<0,DSR∗=DSRmin,βSR>0unknown,βSR=0,DSRmax,βSR<0,DIR∗=DIRmin,βIR>0,unknown,βIR=0,DIRmax,βIR<0,DLR∗=DLRmin,βLR>0,unknown,βLR=0,DLRmax,βLR<0,where βSI, βID, βSR, βIR, and βLR satisfy the following equation:(12)βSI=λIt−λStπr2LSIStIt/SASImax+ASImin,βID=λDt−λItLIDItAIDmax+AIDmin,βSR=λRt−λSt+CPATCHLSRStDSRmax+DSRmin,βIR=λRt−λIt+CPATCHLIRItDIRmax+DIRmin,βLR=λRt−λLt+CLRLLRLtDLRmax+DLRmin.Proof.
According to (2)–(6) and (8), we can construct the Hamiltonian function as shown below:(13)H=λStStdt+λItItdt+λLtLtdt+λRtRtdt+λDtDtdt−CSSt+CIIt−CRRt+CLLt+CDDt−CLRPLRLt−CIRPIRIt+CSRPSRSt.
From state functions (2)–(6) and payoff function (8), the following characteristics have been found out:1
The five state functions and the payoff function are all continuous in time2
The control variables are all bounded and continuous in the state functions and payoff function
Thus, there must exist a saddle pointμ∗t,ν∗t that meets (14) according to [39]:(14)Jμ∗t,νt≤Jμ∗t,ν∗t≤Jμ∗t,ν∗t,where Jμ∗t,νt represents the cost incurred when only the optimal strategy is selected by WSNs. Jμ∗t,νt also denotes that only malicious programs choose the optimal strategy. Jμ∗t,νt indicates that not only the networks choose the optimal strategy but also malicious programs choose the optimal strategy.
According to [40] and the characteristics of this model, there must be a V satisfying(15)V=maxνtminμtJμt,νt=minμtmaxνtJμt,νt=Jμ∗t,ν∗t,where maxνtminμtJμt,νt represents the cost incurred by WSNs in selecting the optimal strategy after the malicious programs makes optimal decision, while minμtmaxνtJμt,νt denotes the cost incurred when the order of two sides is switched.
The following co-state differential equations (16)–(20) determine the co-state variables λSt, λIt, λRt, λLt, and λDt, which are all time dependent:(16)dλStdt=−dHdSt=λSt−λItπr2I∗tASI∗LSIASImax+ASIminS+CS−CPATCHDSR∗LSRDSRmax+DSRmin+λSt−λLtPSL+λSt−λRtDSR∗LSRDSRmax+DSRmin,(17)dλStdt=−dHdIt=λSt−λItπr2S∗tASI∗LSIASImax+ASIminS−CI+λIt−λRtDIR∗LIRDIRmax+DIRmin−CPATCHDIR∗LIRDIRmax+DIRmin+λIt−λLtPIL+λIt−λDtAID∗LID,(18)dλL∗tdt=−dHdLt=λLt−λRtDLR∗LLRDLRmax+DLRmin+λLt−λDtPLD−CL−CLRDLR∗LLRDLRmax+DLRmin,(19)dλR∗tdt=−dHdRt=λLt−λRtPRL+CR,(20)dλD∗tdt=−dHdDt=−CD.
Meanwhile, the terminal value of the co-state variables satisfies(21)λStf=dϕdSt=CSf,λItf=dϕdIt=CIf,λLtf=dϕdLt=CLf,λRtf=dϕdRt=CRf,λDtf=dϕdDt=CDf.
According to Pontryagin’s Maximum Principle, whenλIt−λStπr2LSIStIt/S/ASImax+ASImin is greater than 0, the malicious programs will choose the maximum control ASImax in order to make the cost as large as possible. On the contrary, supposing λIt−λStπr2LSIStIt/S/ASImax+ASImin is less than 0, the malicious programs will choose the minimum control ASImax to maximize the cost. Similarly, when λDt−λItLIDIt/AIDmax+AIDmin is greater than 0, the malicious programs will choose AIDmax, and the malicious programs will choose AIDmin if λDt−λItLIDIt/AIDmax+AIDmin is less than 0.
For WSNs, in caseλRt−λSt+CPATCHLSRSt/DSRmax+DSRminis greater than 0, it will adopt the minimum control DSRmin to make the cost as small as possible. Maximum control DSRmax is taken to minimize the cost, when λRt−λSt+CPATCHLSRSt/DSRmax+DSRminis less than 0. In terms of restoration measures for infected nodes, if λRt−λIt+CPATCHLIRIt/DIRmax+DIRminis greater than 0, WSNs will choose the minimum control DIRmin, while WSNs will choose the maximum control DIRmax when λRt−λIt+CPATCHLIRIt/DIRmax+DIRmin is less than 0. WSNs also takes similar measures to nodes moving from the low-energy state to recovered state. The node will take the maximum control DLRmax supposing λRt−λLt+CLRLLRLt/DLRmax+DLRminis less than 0, while the node will take the minimum control DLRmin if λRt−λLt+CLRLLRLt/DLRmax+DLRminis greater than 0.


## 4. Simulation

In this chapter, two parts are discussed. In the first part, based on the dynamic strategy, charging factor is further analyzed to illustrate its advantages. The second part will compare and analyze with other control combinations to highlight the points of bang-bang control. In these two parts, simulations are verified on MATLAB R2017 B and the memory specification of the computer is 8 GB 1600 MHz DDR3.In our assumptions, nodes are distributed at random in a two-dimensional region with an area of 10,000m2. The maximum transmission radius of a node is 10 m, and the neighbor nodes must exist within the maximum transmission range of the nodes. UAVs will perform nodes’ patching and wireless charging operations together. At the beginning of the game, most of the nodes are in the susceptible state, and the rest are in the infected state. The maximum value of all control levels is assumed to be 1, and the minimum value is assumed to be 0. The parameters are set as shown in Table 1. According to the Pontriagin Maximum Principle, the algorithm of the Attack-Defense Game based on the SILRD model will be briefly explained in the form of pseudocode in Algorithm 1.Table 1
Experimental parameters.
ParameterDescriptionValueLSIProbability of nodes converting from the susceptible state to infected state0.1LIDProbability of nodes converting from the infected state to dead state0.05LSRProbability of nodes converting from the susceptible state to recovered state0.2PILProbability of nodes converting from the infected state to low-energy state0.005LLRProbability of nodes converting from the low-energy state to recovered state0.2PSLProbability of nodes converting from the susceptible state to low-energy state0.005PLDProbability of nodes converting from the low-energy state to dead state0.005PRLProbability of nodes converting from the recovered state to low-energy state0.005CSRCost of nodes converting from the susceptible state to recovered state5CIRCost of nodes converting from the infected state to recovered state7CSCost of nodes in the susceptible state12CDCost of nodes in the dead state20CICost of nodes in the infected state12CRCost of nodes in the recovered state15CLCost of nodes in the low-energy state15CLRCost of nodes converting from the low-energy state to recovered state10S0The ratio of the initial number of susceptible nodes95%I0The ratio of the initial number of infected nodes5%L0The ratio of the initial number of low-energy nodes0%R0The ratio of the initial number of recovered nodes0%D0The ratio of the initial number of dead nodes0%Algorithm 1: Attack-Defense Game based on the SILRD Model.
(1)
Initialize all coefficients;(2)
Defineαt=St,It,Lt,Rt,Dt;(3)
Defineβt=λSt,λIt,λLt,λRt,λDt;(4)
Defineγt=μt,νt;(5)
ift=0then(6)
Substituteα0andγ0 into (2)–(6);(7)
Substituteα0,β0andγ0 into (17)–(21);(8)
end if(9)
fort=1 to Tdo(10)
Substituteαtandγt into (2)–(6);(11)
Substituteαt,βtandγt into (17)–(21);(12)
Substituteαt+1andβt+1 into (9)–(13);(13)
end for


### 4.1. Dynamic Strategies in the Game between WSNs and Malicious Programs

This section will focus on the evolution on different nodes, control rules, and overall costs. At the same time, it is worth noting that this section will compare the case of no energy input.


#### 4.1.1. The Variation Trend of Nodal States

Here, the variation trend of each state quantity over time under two cases will be compared. In particular, similar state quantities are contrasted in one simulation diagram for further analysis. Each state quantity curve is constructed from 100 sample points. The number of each type of nodes is evolved based on (2)–(6). The difference between Figures 2 and 3 is whether or not charging involved.Figure 3
Evolution of five types of nodes. In order to emphasize the impact of charging, this experiment takes charging as a research factor. (a) The evolution of nodes under the condition of charging (i.e., with energy inputs). (b) The evolution of nodes under the condition of no charging (i.e., without energy input).
(a)(b)It can be seen from the comparison between Figure3(a) and Figure 3(b) that, in the SILRD model proposed in this paper, energy input, namely, charging, has little influence on the number of susceptible nodes and infected nodes because charging does not directly affect such high-energy nodes.Although the curves of the same type of nodes are similar in both cases, there exist numerical difference. The number of recovered nodes increased to 17.1% with energy input, up by 6% compared with the case of no energy input, and low-energy and death nodes decreased by 1.8% and 4.1%.


#### 4.1.2. Comparison of Dynamic Optimal Control

Here, the reason for the evolution of states’ quantities will be investigated, that is, the change of control levels of both sides in the game. WhenT = 0, the initial value of each controls is assumed to be 1. The malicious programs select the strategy according to (9) and (10), and WSNs choose according to (11)–(13).Figure 4
Optimal dynamic control with charging factors. This figure shows how the five control variables change over 100 days.Malicious programs stopped propagation on the third day because the peak of infection has been arrived. Even so, the damage from malicious programs continued until the end of the game, that is, the malicious programs have not been cleaned up.Similarly, WSNs stopped patching infected and susceptible nodes on the second day of the game, as depicted in Figures4 and 5. Because malicious programs are no longer spreading, patching vulnerable nodes is not cost effective. The same applies to infected nodes. Even if the malicious programs still exist, it costs more to patch them, so it stops.Figure 5
Optimal dynamic control without charging factors. The difference (Figure4) is the change of the five control variables in the absence of UAVs within 100 days.The difference between Figures4 and 5 is that the former adds control over energy input to the networks. As can be seen from Figures 3(a) and 4, after the number of recovered nodes reaches a peak, WSNs stop the repair of low-energy nodes to suspend the cost of charging and patching.


#### 4.1.3. Cost Comparison

The costs of four cases will be compared over here. Due to the impact of the dynamic strategies’ end-values, only the cost simulation diagram whenT < 100 will be shown and will explain in detail. The costs are all constructed according to equation (8).As can be seen from Figure 6, without taking the terminal cost (T = 100) into account, strategies with energy inputs can actually reduce cost than strategies without them. Therefore, it is not always good to charge, and sometimes it is more cost effective to use the networks’ residual energy. In the first ten days, the difference between charging and noncharging strategies is nonsignificant. However, with the development of the iteration, the gap continues to expand. From the comparison of costs, the strategies with charging are cost-saving than those without charging. Thus, the benefits of charging can cover the costs of it. It is worth noting that when the charging power is slightly reduced to about 50%, the cost will decrease rapidly. And then as the power continues to drop to about 10%, the cost, at 43 days, exceeds the cost at full power.Figure 6
Cost comparison on four cases. The four cases differ in the level of charging power. The corresponding charging power levels of the curve from top to bottom are 0%, 10%, 100%, and 50%.However, the ranking of costs will change after the end values are taken into account. At this point, the cost order from high to low is strategies with 10% power charging−5.9344×104, strategies with full-power charging −9.9543×104, strategies without charging −1.7139×105, and strategies with 50% power charging −1.7772×105. Therefore, the maximum charging power is not necessary when WSNs are evenly replenished. Because larger power means more nodes are converted to the high-energy state, but costs are also rising. There must exist a number of tradeoffs that are lower than both full-power operation and no energy input, such as the 50% power in this paper.


### 4.2. Comparison of Differential Hybrid Control Strategies

In this section, four combination control strategies are discussed. In the above, both the control of patching and charging belong to bang-bang control. In order to highlight the advantages of bang-bang control in the SILRD model, this paper compares it with another common control method which only needs to expand the corresponding control into second term, that is, replaceDSR with DSR2, DIR with DIR2, and DLR with DLR2. It is worth noting that the payoff function describing the game under square control does not change. According to the proof conditions of the Maximum Principle in [38], there still exist a pair of saddle points μ∗t,ν∗t at this time, so the proofs will not be described here again.For the convenience of the following description, this kind of control is named as square control in this paper. Bang-bang control and square control will alternate between charging process and patching process to form four different control combinations.


#### 4.2.1. The Variation Trend of Nodal States

In particular, similar state quantities are contrasted in one simulation diagram for further analysis.The trend of the number of susceptible nodes under four strategies is basically similar, as depicted in Figure7(a). The number of susceptible nodes decayed most slowly when square control was only used to patch high-energy nodes. When the square control is used for charging low-energy nodes, the curves are fairly close. Therefore, if the aim of the network is to keep the number of susceptible nodes as high as possible, the bang-bang control can be applied to patching high-energy nodes and square control for charging and patching low-energy nodes.Figure 7
Evolution of five types of nodes under four control combinations. Unlike the previous section, the research factor considered in Section4.2.1 is the control combination applied to charging and patching. This section considers the control combination of bang-bang control and square control. If bang-bang control is only applied to patching on high-energy nodes, then square control is applied to charging and patching on low-energy nodes. Similarly, if bang-bang control is used to low-energy nodes, then high-energy nodes use square control. If UAVs do not use bang-bang control, then they adopt square control. (a) The number of S-nodes. (b) The number of I-nodes. (c) The number of L-nodes. (d) The number of R-nodes. (e) The number of D-nodes.
(a)(b)(c)(d)(e)As can be seen from Figure7(b), if only the square control is used in WSNs, the number of infections will reach a very high peak at about 13%. Applying square control to patching high-energy nodes is more effective at suppressing the spread of malicious programs than just only using bang-bang control and its peak value is about 5.6%.As can be seen from the comparison between Figures7(c) and 7(d), when bang-bang control is only applied in WSNs, the number of low-energy nodes and recovered nodes are significantly changed. In Figures 7(c) and 7(d), the other three control combinations’ evolution areas similarly. In other words, applying bang-bang control to charging and patching is more effective in suppressing low-energy nodes and boosting the number of recovered nodes. In particular, when only bang-bang control is applied, the peak value of recovered nodes can reach 25%.All control combinations had lower mortality rates, as depicted in Figure7(e). In the first six days, there was little difference in mortality among the combinations. For the first 41 days, applying bang-bang control and square control, respectively, to patching and charging had the lowest mortality. Starting at day 42, the combinations with bang-bang control only had a lower mortality.


#### 4.2.2. Cost Comparison

In this part, the costs of the control combinations will be compared. The combination with the highest cost is the one with only the square control, as can be seen from Figure8. The lowest-cost combination is the one with only the bang-bang control. At the same time, further analysis shows that bang-bang control can be applied to the charging process to reduce the cost effectively.Figure 8
Cost comparison based on four control combinations. The four combinations are consistent with the four in Figure7. The advantages of the combinations are further explained by comparing the costs incurred by them.The reason bang-bang control produces lower costs is because of the jump property of the control. Specifically, when generating revenue, the jump from the minimum control level to the maximum level can quickly yield. Similarly, a jump from the maximum level to minimum can quickly reduce losses.


## 4.1. Dynamic Strategies in the Game between WSNs and Malicious Programs

This section will focus on the evolution on different nodes, control rules, and overall costs. At the same time, it is worth noting that this section will compare the case of no energy input.


### 4.1.1. The Variation Trend of Nodal States

Here, the variation trend of each state quantity over time under two cases will be compared. In particular, similar state quantities are contrasted in one simulation diagram for further analysis. Each state quantity curve is constructed from 100 sample points. The number of each type of nodes is evolved based on (2)–(6). The difference between Figures 2 and 3 is whether or not charging involved.Figure 3
Evolution of five types of nodes. In order to emphasize the impact of charging, this experiment takes charging as a research factor. (a) The evolution of nodes under the condition of charging (i.e., with energy inputs). (b) The evolution of nodes under the condition of no charging (i.e., without energy input).
(a)(b)It can be seen from the comparison between Figure3(a) and Figure 3(b) that, in the SILRD model proposed in this paper, energy input, namely, charging, has little influence on the number of susceptible nodes and infected nodes because charging does not directly affect such high-energy nodes.Although the curves of the same type of nodes are similar in both cases, there exist numerical difference. The number of recovered nodes increased to 17.1% with energy input, up by 6% compared with the case of no energy input, and low-energy and death nodes decreased by 1.8% and 4.1%.


### 4.1.2. Comparison of Dynamic Optimal Control

Here, the reason for the evolution of states’ quantities will be investigated, that is, the change of control levels of both sides in the game. WhenT = 0, the initial value of each controls is assumed to be 1. The malicious programs select the strategy according to (9) and (10), and WSNs choose according to (11)–(13).Figure 4
Optimal dynamic control with charging factors. This figure shows how the five control variables change over 100 days.Malicious programs stopped propagation on the third day because the peak of infection has been arrived. Even so, the damage from malicious programs continued until the end of the game, that is, the malicious programs have not been cleaned up.Similarly, WSNs stopped patching infected and susceptible nodes on the second day of the game, as depicted in Figures4 and 5. Because malicious programs are no longer spreading, patching vulnerable nodes is not cost effective. The same applies to infected nodes. Even if the malicious programs still exist, it costs more to patch them, so it stops.Figure 5
Optimal dynamic control without charging factors. The difference (Figure4) is the change of the five control variables in the absence of UAVs within 100 days.The difference between Figures4 and 5 is that the former adds control over energy input to the networks. As can be seen from Figures 3(a) and 4, after the number of recovered nodes reaches a peak, WSNs stop the repair of low-energy nodes to suspend the cost of charging and patching.


### 4.1.3. Cost Comparison

The costs of four cases will be compared over here. Due to the impact of the dynamic strategies’ end-values, only the cost simulation diagram whenT < 100 will be shown and will explain in detail. The costs are all constructed according to equation (8).As can be seen from Figure 6, without taking the terminal cost (T = 100) into account, strategies with energy inputs can actually reduce cost than strategies without them. Therefore, it is not always good to charge, and sometimes it is more cost effective to use the networks’ residual energy. In the first ten days, the difference between charging and noncharging strategies is nonsignificant. However, with the development of the iteration, the gap continues to expand. From the comparison of costs, the strategies with charging are cost-saving than those without charging. Thus, the benefits of charging can cover the costs of it. It is worth noting that when the charging power is slightly reduced to about 50%, the cost will decrease rapidly. And then as the power continues to drop to about 10%, the cost, at 43 days, exceeds the cost at full power.Figure 6
Cost comparison on four cases. The four cases differ in the level of charging power. The corresponding charging power levels of the curve from top to bottom are 0%, 10%, 100%, and 50%.However, the ranking of costs will change after the end values are taken into account. At this point, the cost order from high to low is strategies with 10% power charging−5.9344×104, strategies with full-power charging −9.9543×104, strategies without charging −1.7139×105, and strategies with 50% power charging −1.7772×105. Therefore, the maximum charging power is not necessary when WSNs are evenly replenished. Because larger power means more nodes are converted to the high-energy state, but costs are also rising. There must exist a number of tradeoffs that are lower than both full-power operation and no energy input, such as the 50% power in this paper.


## 4.1.1. The Variation Trend of Nodal States

Here, the variation trend of each state quantity over time under two cases will be compared. In particular, similar state quantities are contrasted in one simulation diagram for further analysis. Each state quantity curve is constructed from 100 sample points. The number of each type of nodes is evolved based on (2)–(6). The difference between Figures 2 and 3 is whether or not charging involved.Figure 3
Evolution of five types of nodes. In order to emphasize the impact of charging, this experiment takes charging as a research factor. (a) The evolution of nodes under the condition of charging (i.e., with energy inputs). (b) The evolution of nodes under the condition of no charging (i.e., without energy input).
(a)(b)It can be seen from the comparison between Figure3(a) and Figure 3(b) that, in the SILRD model proposed in this paper, energy input, namely, charging, has little influence on the number of susceptible nodes and infected nodes because charging does not directly affect such high-energy nodes.Although the curves of the same type of nodes are similar in both cases, there exist numerical difference. The number of recovered nodes increased to 17.1% with energy input, up by 6% compared with the case of no energy input, and low-energy and death nodes decreased by 1.8% and 4.1%.


## 4.1.2. Comparison of Dynamic Optimal Control

Here, the reason for the evolution of states’ quantities will be investigated, that is, the change of control levels of both sides in the game. WhenT = 0, the initial value of each controls is assumed to be 1. The malicious programs select the strategy according to (9) and (10), and WSNs choose according to (11)–(13).Figure 4
Optimal dynamic control with charging factors. This figure shows how the five control variables change over 100 days.Malicious programs stopped propagation on the third day because the peak of infection has been arrived. Even so, the damage from malicious programs continued until the end of the game, that is, the malicious programs have not been cleaned up.Similarly, WSNs stopped patching infected and susceptible nodes on the second day of the game, as depicted in Figures4 and 5. Because malicious programs are no longer spreading, patching vulnerable nodes is not cost effective. The same applies to infected nodes. Even if the malicious programs still exist, it costs more to patch them, so it stops.Figure 5
Optimal dynamic control without charging factors. The difference (Figure4) is the change of the five control variables in the absence of UAVs within 100 days.The difference between Figures4 and 5 is that the former adds control over energy input to the networks. As can be seen from Figures 3(a) and 4, after the number of recovered nodes reaches a peak, WSNs stop the repair of low-energy nodes to suspend the cost of charging and patching.


## 4.1.3. Cost Comparison

The costs of four cases will be compared over here. Due to the impact of the dynamic strategies’ end-values, only the cost simulation diagram whenT < 100 will be shown and will explain in detail. The costs are all constructed according to equation (8).As can be seen from Figure 6, without taking the terminal cost (T = 100) into account, strategies with energy inputs can actually reduce cost than strategies without them. Therefore, it is not always good to charge, and sometimes it is more cost effective to use the networks’ residual energy. In the first ten days, the difference between charging and noncharging strategies is nonsignificant. However, with the development of the iteration, the gap continues to expand. From the comparison of costs, the strategies with charging are cost-saving than those without charging. Thus, the benefits of charging can cover the costs of it. It is worth noting that when the charging power is slightly reduced to about 50%, the cost will decrease rapidly. And then as the power continues to drop to about 10%, the cost, at 43 days, exceeds the cost at full power.Figure 6
Cost comparison on four cases. The four cases differ in the level of charging power. The corresponding charging power levels of the curve from top to bottom are 0%, 10%, 100%, and 50%.However, the ranking of costs will change after the end values are taken into account. At this point, the cost order from high to low is strategies with 10% power charging−5.9344×104, strategies with full-power charging −9.9543×104, strategies without charging −1.7139×105, and strategies with 50% power charging −1.7772×105. Therefore, the maximum charging power is not necessary when WSNs are evenly replenished. Because larger power means more nodes are converted to the high-energy state, but costs are also rising. There must exist a number of tradeoffs that are lower than both full-power operation and no energy input, such as the 50% power in this paper.


## 4.2. Comparison of Differential Hybrid Control Strategies

In this section, four combination control strategies are discussed. In the above, both the control of patching and charging belong to bang-bang control. In order to highlight the advantages of bang-bang control in the SILRD model, this paper compares it with another common control method which only needs to expand the corresponding control into second term, that is, replaceDSR with DSR2, DIR with DIR2, and DLR with DLR2. It is worth noting that the payoff function describing the game under square control does not change. According to the proof conditions of the Maximum Principle in [38], there still exist a pair of saddle points μ∗t,ν∗t at this time, so the proofs will not be described here again.For the convenience of the following description, this kind of control is named as square control in this paper. Bang-bang control and square control will alternate between charging process and patching process to form four different control combinations.


### 4.2.1. The Variation Trend of Nodal States

In particular, similar state quantities are contrasted in one simulation diagram for further analysis.The trend of the number of susceptible nodes under four strategies is basically similar, as depicted in Figure7(a). The number of susceptible nodes decayed most slowly when square control was only used to patch high-energy nodes. When the square control is used for charging low-energy nodes, the curves are fairly close. Therefore, if the aim of the network is to keep the number of susceptible nodes as high as possible, the bang-bang control can be applied to patching high-energy nodes and square control for charging and patching low-energy nodes.Figure 7
Evolution of five types of nodes under four control combinations. Unlike the previous section, the research factor considered in Section4.2.1 is the control combination applied to charging and patching. This section considers the control combination of bang-bang control and square control. If bang-bang control is only applied to patching on high-energy nodes, then square control is applied to charging and patching on low-energy nodes. Similarly, if bang-bang control is used to low-energy nodes, then high-energy nodes use square control. If UAVs do not use bang-bang control, then they adopt square control. (a) The number of S-nodes. (b) The number of I-nodes. (c) The number of L-nodes. (d) The number of R-nodes. (e) The number of D-nodes.
(a)(b)(c)(d)(e)As can be seen from Figure7(b), if only the square control is used in WSNs, the number of infections will reach a very high peak at about 13%. Applying square control to patching high-energy nodes is more effective at suppressing the spread of malicious programs than just only using bang-bang control and its peak value is about 5.6%.As can be seen from the comparison between Figures7(c) and 7(d), when bang-bang control is only applied in WSNs, the number of low-energy nodes and recovered nodes are significantly changed. In Figures 7(c) and 7(d), the other three control combinations’ evolution areas similarly. In other words, applying bang-bang control to charging and patching is more effective in suppressing low-energy nodes and boosting the number of recovered nodes. In particular, when only bang-bang control is applied, the peak value of recovered nodes can reach 25%.All control combinations had lower mortality rates, as depicted in Figure7(e). In the first six days, there was little difference in mortality among the combinations. For the first 41 days, applying bang-bang control and square control, respectively, to patching and charging had the lowest mortality. Starting at day 42, the combinations with bang-bang control only had a lower mortality.


### 4.2.2. Cost Comparison

In this part, the costs of the control combinations will be compared. The combination with the highest cost is the one with only the square control, as can be seen from Figure8. The lowest-cost combination is the one with only the bang-bang control. At the same time, further analysis shows that bang-bang control can be applied to the charging process to reduce the cost effectively.Figure 8
Cost comparison based on four control combinations. The four combinations are consistent with the four in Figure7. The advantages of the combinations are further explained by comparing the costs incurred by them.The reason bang-bang control produces lower costs is because of the jump property of the control. Specifically, when generating revenue, the jump from the minimum control level to the maximum level can quickly yield. Similarly, a jump from the maximum level to minimum can quickly reduce losses.


## 4.2.1. The Variation Trend of Nodal States

In particular, similar state quantities are contrasted in one simulation diagram for further analysis.The trend of the number of susceptible nodes under four strategies is basically similar, as depicted in Figure7(a). The number of susceptible nodes decayed most slowly when square control was only used to patch high-energy nodes. When the square control is used for charging low-energy nodes, the curves are fairly close. Therefore, if the aim of the network is to keep the number of susceptible nodes as high as possible, the bang-bang control can be applied to patching high-energy nodes and square control for charging and patching low-energy nodes.Figure 7
Evolution of five types of nodes under four control combinations. Unlike the previous section, the research factor considered in Section4.2.1 is the control combination applied to charging and patching. This section considers the control combination of bang-bang control and square control. If bang-bang control is only applied to patching on high-energy nodes, then square control is applied to charging and patching on low-energy nodes. Similarly, if bang-bang control is used to low-energy nodes, then high-energy nodes use square control. If UAVs do not use bang-bang control, then they adopt square control. (a) The number of S-nodes. (b) The number of I-nodes. (c) The number of L-nodes. (d) The number of R-nodes. (e) The number of D-nodes.
(a)(b)(c)(d)(e)As can be seen from Figure7(b), if only the square control is used in WSNs, the number of infections will reach a very high peak at about 13%. Applying square control to patching high-energy nodes is more effective at suppressing the spread of malicious programs than just only using bang-bang control and its peak value is about 5.6%.As can be seen from the comparison between Figures7(c) and 7(d), when bang-bang control is only applied in WSNs, the number of low-energy nodes and recovered nodes are significantly changed. In Figures 7(c) and 7(d), the other three control combinations’ evolution areas similarly. In other words, applying bang-bang control to charging and patching is more effective in suppressing low-energy nodes and boosting the number of recovered nodes. In particular, when only bang-bang control is applied, the peak value of recovered nodes can reach 25%.All control combinations had lower mortality rates, as depicted in Figure7(e). In the first six days, there was little difference in mortality among the combinations. For the first 41 days, applying bang-bang control and square control, respectively, to patching and charging had the lowest mortality. Starting at day 42, the combinations with bang-bang control only had a lower mortality.


## 4.2.2. Cost Comparison

In this part, the costs of the control combinations will be compared. The combination with the highest cost is the one with only the square control, as can be seen from Figure8. The lowest-cost combination is the one with only the bang-bang control. At the same time, further analysis shows that bang-bang control can be applied to the charging process to reduce the cost effectively.Figure 8
Cost comparison based on four control combinations. The four combinations are consistent with the four in Figure7. The advantages of the combinations are further explained by comparing the costs incurred by them.The reason bang-bang control produces lower costs is because of the jump property of the control. Specifically, when generating revenue, the jump from the minimum control level to the maximum level can quickly yield. Similarly, a jump from the maximum level to minimum can quickly reduce losses.


## 5. Conclusion

By using residual energy of nodes as one of the classification criteria, not only the flows of energy between nodes are revealed but also the attack patterns of malicious programs can be further described. The idea of charging, though just pro forma, can be used as a way to fend off malicious programs and reduce mortality of nodes. Meanwhile, the relationship between charging power and game cost has been further revealed in this paper. The advantages of bang-bang control in WSNs against malicious programs are demonstrated. When the cost of patching or charging becomes too high, the bang-bang control rule can quickly jump from maximum to minimum.When considering the process of charging nodes, this paper assumes that charging and patching are carried out simultaneously. However, there may be a delay between the two process. Further analysis shows the way of charging may be affected by various random factors, such as light, wind speed, and human factors. The model would be more precise and practical if more practical conditions were considered. Incorporating more realistic elements into the model is a promising direction for future work.



---

*Source: 5686413-2020-07-03.xml*