使用粒子群優演算法配置兩階層無線感應網路之基地台
全文
(2) Allocating Base Stations in Two-Tiered Wireless Sensor Networks by the Particle Swarm Optimization Advisor: Dr.(Professor) Tzung-Pei Hong Institute of Electrical Engineering National University of Kaohsiung. Student: Guo-Neng Shiu Institute of Electrical Engineering National University of Kaohsiung. ABSTRACT. In wireless sensor networks, minimizing power consumption to prolong network lifetime is very crucial. In this paper, a two-tiered wireless sensor networks consisting of small sensor nodes, application nodes and base-stations is considered. In the past, Pan et al. proposed two algorithms to find the optimal locations of base stations in two-tiered wireless sensor networks. Their approaches assumed the initial energy and the energy-consumption parameters were the same for all application nodes. If any of the above parameters were not the same, their approaches could not work. Recently, the PSO technique has been widely used in finding nearly optimal solutions for optimization problems. In this paper, several algorithms based on particle swarm optimization (PSO) are proposed for general power-consumption constraints. The proposed approaches can search for nearly optimal BS locations in heterogeneous sensor networks, where application nodes may own different data transmission rates, initial energies and parameter values. Experimental results also show the good performance of the proposed PSO approaches and the effects of the parameters on the results. The proposed algorithm can thus help find good BS locations to reduce power consumption and maximize network lifetime in two-tiered wireless sensor networks.. I.
(3) Keywords: wireless sensor network, network lifetime, energy consumption, particle swarm optimization, base station. II.
(4) 使用粒子群優演算法配置在二階層無線感應網路中之 基地台 指導教授:洪宗貝博士 國立高雄大學電機研究所. 學生:徐國能 國立高雄大學電機研究所. 摘要. 在無線感應網路中如何使能量消耗最小並且達到延長網路生命週期是一個 重要的議題。在本論文中,我們所討論的二階層無線網路是由許多小型的感應節 點、以及數個應用節點和基地台所組成的。在過去的研究中 Pan 等人提出兩個演 算法來求得在二階層無線網路中最佳的基地台位置,然而在他們所提出的演算法 運算過程中必需假設所有的應用節點的初始能量和能量損耗參數必需要是一樣 的,如果上述的初始能量或參數不相同時他們的演算法就無法運行。近幾年來, 粒子群優演算法的技術被廣泛的應用在收尋近似最佳解的問題上並且有不錯的 成績。在本論文中,我們提出幾個利用粒子群優演算法技術的演算法來收尋各種 能量損耗公式下的近似最佳解的基地台位置。當各個應用節點擁有不同的初始能 量、不同的傳送數率和不同的參數值時,我們所提出的方法可以在這種異質的無 線感應網路中找到近似最佳解的基地台位置。實驗結果顯示出我們提出的方法在 執行效果上有不錯的結果,我們也顯示出在不同參數的影響下的實驗結果。我們 所提出的演算法可以在二階層無線網路中找到比較好的基地台配置位置,使能量 的損耗變小並且達到網路生命週期最長的時間。 關鍵字:無線感應網路、網路生命週期、能量損耗公式、粒子群優演算法、基地 台. III.
(5) 誌. 謝. 對於這篇論文能順利完成,首先要感謝的是我的指導教授洪宗貝博士。在論 文一開始的構思,老師總是給予中肯的建議和不同角度上的思考方式,而在論文 的撰寫及修改其間,老師更是犧牲了許多與家人相處的時間,在此致上深深的歉 意。在我進入研究所的這兩年期間,老師悉心的指導,並提供良好的學習研究環 境,對我在待人接物、處事態度、邏輯思考和學術研究上有很大的幫助,同時也 順利取得碩士學位,在此致上由衷的感謝。. 同時,我要感謝我的碩士論文口試委員:曾新穆教授、潘正祥教授和吳志宏 教授,謝謝他們能撥冗參加口試會議,並於口試期間給予我相當有建設性的建 議,使我的論文更趨完整。也感謝在這兩年指導我進行研究的教授們,包括林文 揚教授及其他參與研討會議的老師們。此外我還要謝謝陪我一路走來的同學、學 長姐們及學弟們,使我研究所的生涯增添了許多歡笑和回憶。. 最後感謝我的父母及家人的支持、鼓勵和無怨無悔的付出,使我能專心於 學業上,也是我完成碩士學位的主要因素,在此也表達我衷心的謝意。在此謹向 所有幫助過我及默默支持我的人,致上我最深的謝意。. IV.
(6) Index ENGLISH ABSTRACT…………………………………………………………….Ⅰ CHINESE ABSTRACT…………………………………………………………….Ⅲ 誌 謝……………………………………………………………………..Ⅳ LIST OF FIGURES………………………………………………………………....Ⅴ LIST OF TABLES…………………………………………………………………..Ⅶ CHAPER 1 INTRODUCTUON……………………………………………………..1 CHAPER 2 REVIEW OF RELATED WORKS……………………………………5 CHAPER 3 REVIEW OF PARTICLE SWARM OPTIMIZATION……………...8 CHAPER 4 AGENERAL PSO ALGORITHM FOR THE N-of-N LIFETIME PROBLEM……………………………………………………………..16 4.1 ALGORITHM……………………………………………………………........16 4.2 AN EXAMPLE………………………………………………………………..20 CHAPER 5 AGENERAL PSO ALGORITHM FOR THE K-of-N LIFETIME PROBLEM……………………………………………………………..26 5.1 ALGORITHM…………………………………………………………………26 5.2 AN EXAMPLE………………………………………………………………..30 CHAPER 6 AGENERAL PSO ALGORITHM FOR THE m-in-K-of-N LIFETIME PROBLEM……………………………………………….37 6.1 ALGORITHM…………………………………………………………………37 6.2 AN EXAMPLE………………………………………………………………..41 CHAPER 7 AGENERAL PSO ALGORITHM FOR ALLOCATION OF MULTIPLE BASE STATIONS……………………………………….48 7.1 ALGORITHM…………………………………………………………………48 7.2 AN EXAMPLE………………………………………………………………..52 CHAPER 8 EXPERIMENTAL RESULTS………………………………………..61 8.1 EXPERIMENTAL RESULTS FOR N-of-N, K-of-N AND m-in-K-of-N LIFETIME……………………………………………………………………..61 8.2 EXPERIMENTAL RESULTS FOR MULTIPLE BASE STATIONS…………73 CHAPER 9 CONCLUSIONS AND FUTURE WORKS………………………….87 REFERENCES……………………………………………………………………...88. List of Figures Figure 1: A two-tiered architecture of wireless sensor networks……………………...2 Figure 2: Heterogeneous ANs on stacked planes……………………………………...7 Figure 3: The positions of the six given initial particles in the example……………..12 V.
(7) Figure 4: The positions of the given ANs and the initial particles…………………...21 Figure 5: The evolution of the maximal lifetime for the example…………………...25 Figure 6: The positions of the given ANs and the initial particles…………………...31 Figure 7: The evolution of the system lifetime for the example……………………..35 Figure 8: The positions of the given ANs and the initial particles…………………...43 Figure 9: The evolution of the system lifetime for the example……………………..47 Figure 10: The positions of the given ANs and the initial particles………………….54 Figure 11: The evolution of the system lifetime for the example……………………60 Figure 12: The lifetime for 50 ANs and 10 particles…………………………………62 Figure 13: The lifetimes along with different acceleration constants (c1)……………63 Figure 14: The lifetimes along with different acceleration constants (c2)……………64 Figure 15: The lifetimes along with different inertial weights (w)…………………..65 Figure 16: The lifetimes along with different values of the distance-independent parameter (α1)…………………………………………………………….66 Figure 17: The lifetimes along with different values of the distance-dependent parameter (α2)…………………………………………………………….67 Figure 18: The lifetimes along with different numbers of ANs……………………...68 Figure 19: The execution time along with different numbers of ANs………………..69 Figure 20: The lifetimes along with different numbers of particles………………….70 Figure 21: The execution time along with different numbers of particles for 50 ANs ……………………………………………………………………………71 Figure 22: The lifetime for the 40-of-50 lifetime problem and 10 particles…………74 Figure 23: The lifetimes along with different acceleration constants (c1)……………75 Figure 24: The lifetimes along with different acceleration constants (c2)……………76 Figure 25: The lifetimes along with different inertial weights (w)…………………..77 Figure 26: The lifetimes along with different values of the distance-independent parameter (α1)…………………………………………………………….78 Figure 27: The lifetimes along with different values of the distance-dependent parameter (α2)…………………………………………………………….79 Figure 28: The lifetimes along with different numbers of ANs……………………...80 Figure 29: The execution time along with different numbers of ANs………………..81 Figure 30: The lifetimes along with different numbers of particles………………….82 Figure 31: The execution time along with different numbers of particles for 50 ANs ……………………………………………………………………………83 Figure 32: The lifetimes along with different numbers of base stations……………..84 Figure 33: The execution time along with different numbers of base stations and 50 ANs……………………………………………………………………….85. VI.
(8) List of Tables Table 1: The fitness values of all the six particles……………………………………13 Table 2: The pBests after the first generation………………………………………...13 Table 3: The initial parameters of ANs in the example………………………………20 Table 4: The lifetimes of all ANs for all particles……………………………………22 Table 5: The fitness values of all the particles……………………………………….22 Table 6: The pBests after the first generation………………………………………...23 Table 7: The new velocities of all the three particles………………………………...24 Table 8: The new positions of all the three particles………………………………....25 Table 9: The initial parameters of ANs in the example………………………………30 Table 10: The lifetimes of all ANs for all particles…………………………………..32 Table 11: The fitness values of all the particles………………………………………32 Table 12: The pBests after the first generation……………………………………….33 Table 13: The new velocities of all the three particles……………………………….34 Table 14: The new positions of all the three particles………………………………..35 Table 15: The initial parameters of ANs in the example……………………………..42 Table 16: The lifetimes of all ANs for all particles…………………………………..43 Table 17: The fitness values of all the particles……………………………………...44 Table 18: The pBests after the first generation……………………………………….45 Table 19: The new velocities of all the three particles……………………………….46 Table 20: The new positions of all the three particles………………………………..47 Table 21: The initial parameters of ANs in the example……………………………..53 Table 22: The lifetimes of all ANs communicating with all base stations in the three particles……………………………………………………………………55 Table 23: The lifetimes of all ANs for the three particles……………………………55 Table 24: The fitness values of all the three particles………………………………..56 Table 25: The pBests after the first generation……………………………………….57 Table 26: The new velocities of all the three particles……………………………….58 Table 27: The new positions of all the three particles………………………………..59 Table 28: A lifetime comparison of the PSO approach and the exhaustive grid search ……………………………………………………………………………..72 Table 29: A comparison of execution time by the two approaches…………………..72 Table 30: A lifetime comparison of the PSO approach and the exhaustive grid search ……………………………………………………………………………86 Table 31: A comparison of execution time by the two approaches…………………86. VII.
(9) CHAPTER 1 Introduction Along with the advance of Micro-Electro-Mechanical Systems (MEMS) and low-power short-range radios, wireless sensor networks have been widely used in recent years. Sensors in a wireless sensor network can not only collect data from an environment but can also process data and transmit information. Wireless sensor networks must usually take the energy factor into consideration in order to prolong the network lifetime. In the past, many approaches were proposed to efficiently utilize energy in wireless networks. For example, appropriate transmission ways were designed to save energy for multi-hop communication in ad-hoc networks [16][10][5][19][7][6][20]. Good algorithms for allocation of base stations and sensors nodes were also proposed to reduce power consumption [12][15][16][8][9]. Recently, a two-tiered architecture of wireless sensor networks has been proposed and become popular [1]. It is motivated by the latest advances in distributed signal processing and source coding and can offer a more flexible balance among reliability, redundancy and scalability of wireless sensor networks. A two-tiered wireless sensor network, as shown in Figure 1, consists of sensor nodes (SNs), application nodes (ANs), and one or several base stations (BSs).. 1.
(10) SN AN BS. Figure 1: A two-tiered architecture of wireless sensor networks. Sensor nodes are usually small, low-cost and disposable, and do not communicate with other sensor nodes. They are usually deployed in clusters around interesting areas. For instance, sensor nodes may be used to detect a designated target, environment temperature and humidity, among others. Each cluster of sensor nodes is allocated with at least one application node. Application nodes possess longer-range transmission, higher-speed computation, and more energy than sensor nodes. The raw data obtained from sensor nodes are first transmitted to their corresponding application nodes. After receiving the raw data from all its sensor nodes, an application node conducts data fusion within each cluster. It then transmits the aggregated data directly to the base station or via multi-hop communication. The base station is usually assumed to have unlimited energy and powerful processing 2.
(11) capability. It also serves as a gateway for wireless sensor networks to exchange data and information to other networks. Wireless sensor networks usually have some assumptions for SNs and ANs. For instance, each AN may be aware of its own location through receiving GPS signals [11] and its own energy. A fundamental problem in wireless sensor networks is to maximize the system lifetime under some given constraints. Pan et al. proposed two algorithms to find the optimal locations of base stations in two-tiered wireless sensor networks [13]. Their approaches assumed the initial energy and the energy-consumption parameters were the same for all ANs. If any of the above parameters were not the same, their approaches could not work. In this paper, an algorithm based on particle swarm optimization (PSO) is proposed to find the base-station locations for general power-consumption constraints. The PSO technique was proposed by Eberhart and Kennedy in 1995 [2][3] and has been widely used in finding solutions for optimization problems. Some related researches about its improvement and applications has also been proposed [4][14][17][18]. It maintains several particles (each represents a solution) and simulates the behavior of bird flocking to find the final solutions. All the particles continuously move in the search space, tending to better solutions, until the termination criteria are met. After a lot of generations, the optimal solution or an. 3.
(12) approximate optimal solution is expected to be found. The proposed approach can search for nearly optimal BS locations in heterogeneous sensor networks. Experimental results also show the performance of the proposed PSO approach on finding the BS locations and the effects of the parameters on the results. The remaining parts of this paper are organized as follows. Some related works about finding the locations of base stations in a two-tiered wireless networks is reviewed in Section 2. The PSO approach is introduced in Section 3. Four algorithms based on PSO to discover base stations in a two-tiered wireless networks are proposed in Section 4, 5, 6, and 7, with some examples given to illustrate them. Experimental results for demonstrating the performance of the algorithm and the effects of the parameters are described in Section 8. Conclusions and future works are stated in Section 9.. 4.
(13) CHAPTER 2 Review of Related Works As mentioned above, a fundamental problem in wireless sensor networks is to maximize the system lifetime under some given constraints. Pan et al. proposed two algorithms to find the optimal locations of base stations in two-tiered wireless sensor networks [13]. The first algorithm was used to find the optimal locations of base stations for homogenous ANs, and the second one was used for heterogeneous ANs. Homogenous ANs had the same data transmission rate and heterogeneous ANs might have different data transmission rates. In their paper, only the energy in ANs was considered. If a single SN ran out of energy, its corresponding AN might still have the capability to collect enough information. However, if an AN ran out of energy, the information in its coverage range would be completely lost, which was dangerous to the whole system. They considered the maximum lifetime in three kinds of conditions: N-of-N, K-of-N, and m-in-K-of-N [13]. They are explained below. 1. N-of-N lifetime: Give N ANs, the mission fails when any of the N ANs runs out of energy. 2. K-of-N lifetime: Give N ANs, the mission survives as long as there are at least K ANs alive, or the mission fails when N-K+1 ANs run out of energy. 3. m-in-K-of-N lifetime: Give N ANs, the mission survives as long as all the m 5.
(14) predefined supporting (necessary) ANs are alive and overall at least K ANs are alive (1≦m≦K≦N). Let d be the Euclidean distance from an AN to a BS, and r be the data transmission rate. Pan et al. adopted the following formula to calculate the energy consumption per unit time: p ( r , d ) = r (α 1 + α 2 d n ) ,. (1). where α1 is a distance-independent parameter and α2 is a distance-dependent parameter. The energy consumption thus relates to Euclidean distances and data transmission rates. Pan et al. assumed each AN had the same α1, α2 and initial energy. For homogenous ANs, they showed that the center of the minimal circle covering all the ANs was the optimal BS location (with the maximum lifetime) for the N-of-N condition. They also extended their approach to find the optimal BS location for the K-of-N and the m-in-K-of-N conditions. They then tried to find the optimal BS location for heterogeneous ANs, which had different transmission rates. When the transmission rates (ri) in the ANs were different, the optimal BS location could not be determined by the center of the minimal circle. Pan et al. thus introduced the concept of stacked planes to solve this problem. They neglected the α1 term and assumed the initial energy was the same for. 6.
(15) all ANs. The lifetime time li for the i-th AN (ANi) could thus be derived as follows: li = ei ( 0 ) riα 2 d in ,. (2). where ei(0) was the initial energy of ANi, ri was the data transmission rate of ANi and di was the Euclidean distance from ANi to the BS. They used the variable ki to combine the constants: 1. k i = ( ei ( 0 ) riα 2 ) n .. (3). Without loss of generality, they assumed that k1 ≤ k 2 ≤ ... ≤ k n . An additional dimension for ki’s was then used to form stacked planes as shown in Figure 2, where the ANs with the same ki values lay on the same plane. In this case, the optimal BS location was located at the tip of the minimal enclosing cone.. BS k1. P0. kn. P1. … Pn. Figure 2: Heterogeneous ANs on stacked planes. 7.
(16) CHAPTER 3 Review of Particle Swarm Optimization. As mentioned above, the PSO concept originated from the behavior of bird flocking. Suppose there is a group of birds searching for food in an area. Also assume each bird has the instinct of remembering its own location with the most food in its experience. Besides, all the birds can exchange their best experiences to each other and thus learn the location with the most food found so far in the search space. Each bird thus knows both the best location in its experience and the best one from the flock of birds, and will tend to move according to the two locations. The PSO approach thus simulates the mentioned behaviors of bird flocking to find solutions of optimization problems. When the PSO technique is used to solve a problem, each possible solution in the search space is called a particle, which is similar to a bird mentioned above. All the particles are evaluated by a fitness function, with the values representing the goodness degrees of the solutions. The solution with the best fitness value for a particle can be regarded as the local optimal solution found so far and is stored as the pBest solution for the particle. The best one among all the pBest solutions is regarded as the global optimal solution found so far for the whole set of particles, and is called the gBest. 8.
(17) solution. In addition, each particle moves with a velocity, which will dynamically change according to pBest and gBest. After finding the two best values, a particle updates its velocity by the following equation: Vidnew = w × Vidold + c1 × Rand 1 () × ( pBest id − xid ) + c2 × Rand 2 () × ( gBest d − xid ) ,. (4). where the terms are explained below. 1. Vidnew : the velocity of the i-th particle in the d-th dimension in the next generation; 2. Vidold : the velocity of the i-th particle in the d-th dimension in the current generation; 3. pBestid: the current pBest value of the i-th particle in the d-th dimension; 4. gbestd: the current gBest value of the whole set of particles in the d-th dimension; 5. xid: the current position of the i-th particle in the d-th dimension; 6. w: the inertial weight, generally set at 1 [17]; 7. c1: the acceleration constant for a particle to move to its pBest, generally set at 2 [3]; 8. c2: the acceleration constant for a particle to move to the gBest, generally set at 2 [3]; 9. Rand1(), Rand2(): two random numbers between 0 to 1.. 9.
(18) After the new velocity is found, the new position for a particle can then be obtained by the following formula: x idnew = x idold + V idnew .. (5). All the particles thus continuously move in the search space, tending to better solutions, until the termination criteria are met. After a lot of generations, an approximate optimal solution is expected to be found. The PSO algorithm is stated below.. The PSO algorithm: Step 1: Define a fitness function for the problem to be solved. Step 2: Initialize the fitness values of all pBests and the gBest to zero. Step 3: Randomly generate a group of n particles, each representing a feasible solution to the problem. Step 4: Randomly generate an initial velocity for each particle. Step 5: Calculate the fitness value of each particle according to the fitness function. Step 6: Replace pBesti with the current i-th particle if the fitness value fitnessi of the i-th particle is better than the fitness value of pBesti. Step 7: Replace gBest with the best pBest among all the particles if the fitness value of the best pBest is better than the fitness of the gBest.. 10.
(19) Step 8: Update the velocity of the i-th particle as: Vidnew = w × Vidold + c1 × Rand 1 () × ( pBest id − xid ) + c2 × Rand 2 () × ( gBest d − xid ) .. Step 9: Update the position of the i-th particle as:. x new = x old + V idnew . id. id. Step 10: Repeat Steps 5 to 9 until the termination conditions are satisfied.. Some common termination conditions are generation numbers, computational time limit and solution convergence. Below, a simple example in a two-dimensional search space is given to explain the concept of the PSO approach. Assume two variables x and y are to be found, such that the sum of x and y will be closest to 100. The problem can actually be solved by mathematical approaches. It is used here only for illustrating how the PSO algorithm works. For the simple problem, the PSO algorithm proceeds as follows.. Step 1: An appropriate fitness function is defined for the problem. In this example, the fitness function is set as |x+y-100|. A smaller fitness values means a better solution. Step 2: The initial fitness values of all pBests and the gBest are set to zero. Step 3: A group of n particles are generated at random. Assume n is set at 6 in this. 11.
(20) example for simplicity. Also assume the six initial random particles are (30, 30), (10, 10), (10, 0), (20, 20), (40, 30) and (40, 20). Figure 3 shows the positions of the six given initial particles.. 35 30. 30, 30. 40, 30. 25 20, 20. 40, 20. y. 20 15 10, 10. 10 5 0 0. 5. 10, 0 10 15. 20. 25. 30. 35. 40. 45. x. Figure 3: The positions of the six given initial particles in the example. Step 4: An initial velocity is randomly generated for each particle. In this example assume the initial velocity is set at zero for simplicity. Step 5: The fitness value of each particle is calculated. Take the first particle as an example. Its fitness is calculated as |30+30-100|, which is 40. In the same way, the fitness values of all the particles are calculated and shown in Table 1.. 12.
(21) Table 1: The fitness values of all the six particles Particle Position Fitness 1. (30, 30). 40. 2. (10, 10). 80. 3. (10, 0). 90. 4. (20, 20). 60. 5. (40, 30). 30. 6. (40, 20). 40. Step 6: The fitness value of each particle is compared with that of the corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. In the first generation, the fitness values of all the pBests are zero, smaller than those of the particles. The particles are then stored as the new pBests. The resulting pBests are shown in Table 2, where the field “appearing generation” represents the generation number in which a particle is set as the current pBest.. Table 2: The pBests after the first generation pBesti Position Fitness. Appearing Generation. 1. (30, 30). 40. 1. 2. (10, 10). 80. 1. 3. (10, 0). 90. 1. 4. (20, 20). 60. 1. 5. (40, 30). 30. 1. 6. (40, 20). 40. 1. 13.
(22) Step 7: The best pBesti among all the particles is chosen as the gBest. In this example, pBest5 has the largest fitness value and is set as the gBest. Step 8: The new velocity of each particle is updated. Assume the inertial weight w is set at 1, the acceleration constant c1 for a particle to move to pBest is set at 2, and the acceleration constant c2 for a particle to move to gBest is set at 2. Take the first particle as an example to illustrate the step. Its new velocity is calculated as follows: V1xnew = w × V1xold + c1 × Rand () × ( pBest 1x − x1x ) + c 2 × Rand () × ( gBest d − x1x ) 2. 1. =1*0+2*0.5(30-30)+2*1(40-30) = 20, and V1ynew = w × V1yold + c1 × Rand () × ( pBest 1y − x1y ) + c2 × Rand () × ( gBest d − x ) 4. 3. 1y. 1*0+2*0.8(30-30)+2*0.4(30-30) = 0, where the four random numbers generated are 0.5, 1, 0.8 and 0.4, respectively. The new velocity for the other particles can be similarly calculated. Step 9: The position of each particle is updated. Take the first particle as an example. Its new position is calculated as follows:. x new = x old + V 1new x 1x. 1x. = 30 + 20. 14.
(23) = 50, and. x 1new = x 1old + V 1new y y y = 30 + 0 = 30. The new positions of the other particles can be similarly derived. Step 10: Steps 5 to 9 are repeated until the termination conditions are satisfied.. 15.
(24) CHAPTER 4 A General PSO Algorithm for the N-of-N Lifetime Problem. 4.1 Algorithm. The ANs produced by different manufacturers may own different data transmission rates, initial energies and parameter values. When different kinds of ANs exist in a wireless network, it is hard to find the optimal BS location. In this section, a heuristic algorithm based on PSO to search for optimal BS locations under general constraints is proposed. An initial set of particles is first randomly generated, with each particle representing a possible BS location. Each particle is also allocated an initial velocity for changing its state. Let ej(0) be the initial energy, rj be the data transmission rate, αj1 be the distance-independent parameter, and αj2 be the distance-dependent parameter of the j-th AN. The lifetime lij of an application node ANj for the i-th particle is calculated by the following formula: lij = e j (0) rj (α j + α j d ijn ) ,. (6). where d ijn is the n-order Euclidian distance from the j-th AN to the i-th particle. The fitness function used for evaluating each particle is thus shown below:. 16.
(25) N. fitness (i ) = Min{lij }, j =1. (7). where N is number of ANs. That is, each particle takes the minimal lifetime of all ANs as its fitness value. A larger fitness value denotes a longer lifetime of the whole system, meaning the corresponding BS location is better. The fitness value of each particle is then compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. The best pBesti among all the particles is chosen as the gBest. Besides, each particle has a velocity, which is used to change the current position. All particles thus continuously move in the search space. When the termination conditions are achieved, the final gBest will be output as the location of the base station. The proposed algorithm is stated below.. The proposed PSO algorithm for finding the best BS location: Input: A set of ANs, each ANj with its location (xj, yj), data transmission rate rj, initial energy ej(0), parameters αj1 and αj2. Output: A BS location that will cause a nearly maximal lifetime in the whole system. Step 1: Initialize the fitness values of all pBests and the gBest to zero. Step 2: Randomly generate a group of n particles, each representing a possible BS location. Locations may be two-dimensional or three-dimensional, depending. 17.
(26) on the problems to be solved. Step 3: Randomly generate an initial velocity for each particle. Step 4: Calculate the lifetime lij of the j-th AN for the i-th particle by the following formula: lij = e j (0) r j (α j1 + α j 2 d ijn ),. where ej(0) is the initial energy, rj is the data transmission rate, αj1 is a distance-independent parameter, αj2 is a distance-dependent parameter of the j-th AN, and d ijn is the n-order Euclidean distance from the i-th particle (BS) to the j-th AN. Step 5: Calculate the lifetime of the whole sensor system for the i-th particle as its fitness value (fitnessi) by the following formula: N. fitness (i ) = Min{lij } , j =1. where N is number of ANs and i = 1 to n. Step 6: Set pBesti as the current i-th particle if the value of fitness(i) is larger than the current fitness value of pBesti. Step 7: Set gBest as the best pBest among all the particles. That is, let: fitness of pBestk = maxin=1 fitness of pBesti, and set gBest=pBestk. Step 8: Update the velocity of the i-th particle as:. 18.
(27) Vidnew = w × Vidold + c1 × Rand () × ( pBestid − xid ) + c 2 × Rand () × ( gBest − xid ) , 1. 2. d. where Vidnew is the new velocity of the i-th particle at the d-th dimension, V idold. is the current velocity of the i-th particle at the d-th dimension, w is the. inertial weight, c1 is the acceleration constant for particles moving to pBest, c2 is the acceleration constant for particles moving to gBest, Rand1() and Rand2() are two random numbers among 0 to 1, xid is the current position of the i-th particle at the d-th dimension, pBestid is the value of pBesti at the d-th dimension, and gBestd is the value of gBest at the d-th dimension. Step 9: Update the position of the i-th particle as:. x new = x old + V idnew , id. id. new where xid and xidold are respectively the new position and the current. position of the i-th particle at the d-th dimension. Step 10: Repeat Steps 4 to 9 until the termination conditions are satisfied.. In Step 10, the termination conditions may be predefined execution time, a fixed number of generation or when the particles have converged to a certain threshold.. 19.
(28) 4.2 An Example. In this section, a simple example in a two-dimensional space is given to explain how the PSO approach can be used to find the best BS location that will generate the nearly maximal lifetime in the whole system. Assume there are totally four ANs in this example and their initial parameters are shown in Table 3, where “Location” represents the two-dimensional coordinate position of an AN, “Rate” represents the data transmission rate, and “Power” represents the initially allocated energy. All αj1’s are set at 0 and all αj2’s at 1 for simplicity.. Table 3: The initial parameters of ANs in the example AN Location Rate Power 1. (1, 10). 5. 10000. 2. (11, 0). 5. 10000. 3. (8, 7). 4. 6400. 4. (4, 3). 4. 6400. For the example, the proposed PSO algorithm proceeds as follows.. Step 1: The initial fitness values of all pBests and the gBest are set to zero. Step 2: A group of n particles are generated at random. Assume n is set at 3 in this example for simplicity. Also assume the three initial particles randomly. 20.
(29) generated are located at (4, 7), (9, 5) and (6, 4). Figure 4 shows the positions of the given ANs and the initial particles, where the triangles represent the particles and the circles represent the ANs.. 12 11 10. 1. 9 8 7. 3. 1. 6 5. 2. 4. 3. 3. 4. 2 1 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 2 11. 12. Figure 4: The positions of the given ANs and the initial particles. Step 3: An initial velocity is randomly generated for each particle. In this example assume the initial velocity is set at zero for simplicity. Step 4: The lifetime of each AN for a particle is calculated. Take the first AN for the first particle as an example. Its lifetime is calculated as follows: l11 = 10000 5[(4 − 1) 2 + (7 − 10) 2 ] = 111.11 . The lifetimes of all ANs for all particles are shown in Table 4.. 21.
(30) Table 4: The lifetimes of all ANs for all particles Particle. AN. 1(1, 10) 2(11, 0) 3(8, 7) 4(4, 3). 1(4, 7). 111.11. 20.41. 100. 100. 2(9, 5). 22.47. 68.97. 320. 55.17. 3(6, 4). 32.79. 48.78. 123.08. 320. Step 5: The lifetime of the whole sensor system for each particle is calculated as the fitness value. Take the first particle as an example. Its fitness is calculated as follows:. Fitness(1) = Min{l11, l12, l13, l14} = Min{111.11, 20.41, 100, 100} = 20.41.. In the same way, the fitness values of all the particles are calculated and shown in Table 5.. Table 5: The fitness values of all the particles Particle Location Fitness 1. (4, 7). 20.41. 2. (9, 5). 22.47. 3. (6, 4). 32.79. Step 6: The fitness value of each particle is compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. In the first generation, the fitness values of all the pBests are zero, smaller than those of the particles. The. 22.
(31) particles are then stored as the new pBests. The resulting pBests are shown in Table 6, where the field “appearance generation” represents the generation number in which a particle is set as the current pBest.. Table 6: The pBests after the first generation Particle Location Fitness. Appearing Generation. 1. (4, 7). 20.41. 1. 2. (9, 5). 22.47. 1. 3. (6, 4). 32.79. 1. Step 7: The best pBesti among all the particles is chosen as the gBest. In this example, pBest3 has the largest fitness value and is set as the gBest. Step 8: The new velocity of each particle is updated. Assume the inertial weight w is set at 1, the acceleration constant c1 for particles moving to pBest is set at 2, and the acceleration constant c2 for particles moving to gBest is set at 2. Take the first particle as an example to illustrate the step. Its new velocity is calculated as follows: V1xnew = w × V1xold + c1 × Rand () × ( pBest 1x − x1x ) + c2 × Rand () × ( gBest d − x1x ) 2. 1. = 1 × 0 + 2 × 0 .5( 4 − 4 ) + 2 × 0 .25 ( 6 − 4 ). = 1, and V1ynew = w × V1yold + c1 × Rand () × ( pBest 1y − x1y ) + c2 × Rand () × ( gBest d − x ) 4. 3. 23. 1y.
(32) = 1 × 0 + 2 × 1(7 − 7) + 2 × 0.125( 4 − 7). = -0.75, where the four random numbers generated are 0.5, 0.25, 1 and 0.125, respectively. In the same way, the new velocities of the other two particles can be calculated. The results are shown in Table 7.. Table 7: The new velocities of all the three particles Particle Old Location. Velocity. 1. (4, 7). (1, -0.75). 2. (9, 5). (-1.2, -0.2). 3. (6, 4). (0, 0). Step 9: The position of each particle is updated. Take the first particle as an example. Its new position is calculated as follows: x 1new = x 1old + V 1new x x x. =4+1 = 5, and x 1new = x 1old + V 1new y y y = 7 + (-0.75) = 6.25. In the same way, the new positions of all the other two particles can be found. The results are shown in Table 8. 24.
(33) Table 8: The new positions of all the three particles Particle Old Location. Velocity. New Location. 1. (4, 7). (1, -0.75). (5, 6.25). 2. (9, 5). (-1.2, -0.2). (7.8, 4.8). 3. (6, 4). (0, 0). (6, 4). Step 10: Steps 4 to 9 are then repeated until the termination conditions are satisfied. The lifetime evolution along with different generations is shown in Figure 5.. 45 40 35 30. Lifetime. 25 20 15 10 5 0 0. 20. 40. 60. 80. 100. Generations. Figure 5: The evolution of the maximal lifetime for the example. For this example, the solutions converge after about 70 generations. The maximal lifetime is 38.8662 time units located at (5.8292, 4.6956). The optimal solution of this example is 40 time units located at (6, 5) by exhaustive search. The solution found by the proposed heuristic algorithm is close to the optimal one. 25.
(34) CHAPTER 5 A General PSO Algorithm for the K-of-N Lifetime Problem. 5.1 Algorithm. In this section, a heuristic algorithm based on PSO to solve the K-of-N lifetime problem under general constraints is proposed. An initial set of particles is first randomly generated, with each particle representing a possible BS location. Each particle is also allocated an initial velocity for changing its state. Let ej(0) be the initial energy, rj be the data transmission rate, αj1 be the distance-independent parameter, and αj2 be the distance-dependent parameter of the j-th AN. The lifetime lij of an application node ANj for the i-th particle is calculated by the following formula: lij = e j (0) rj (α j + α j d ijn ) ,. (8). where d ijn is the n-order Euclidian distance from the j-th AN to the i-th particle. In the K-of-N lifetime problem, given N ANs, the system survives as long as at least K ANs are alive. Restated, the system fails when at least N-K+1 ANs run out of energy. The fitness function used for evaluating each particle is thus shown below: N. fitness (i ) = Min N − K +1 {lij } . j =1. 26. (9).
(35) That is, the fitness of the i-th particle is its (N-K+1)-th minimal lifetime among all the ANs. A larger fitness value thus denotes a better solution quality for the K-of-N lifetime problem, meaning the corresponding BS location is better. The fitness value of each particle is then compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. The best pBesti among all the particles is chosen as the gBest. Besides, each particle has a velocity, which is used to change the current position. All particles thus continuously move in the search space. When the termination conditions are achieved, the final gBest will be output as the location of the base station. The proposed algorithm is stated below.. The proposed PSO algorithm for the K-of-N lifetime problem: Input: A set of N ANs, each ANj with its location (xj, yj), data transmission rate rj, initial energy ej(0), parameter αj1, parameter αj2, and the allowed number K of alive ANs. Output: A BS location that will cause a nearly maximal lifetime for the K-of-N lifetime problem. Step 1: Initialize the fitness values of all pBests and the gBest to zero. Step 2: Randomly generate a group of n particles, each representing a possible BS. 27.
(36) location. Locations may be two-dimensional or three-dimensional, depending on the problems to be solved. Step 3: Randomly generate an initial velocity for each particle. Step 4: Calculate the lifetime lij of the j-th AN for the i-th particle by the following formula: lij = e j (0) r j (α j1 + α j 2 d ijn ),. where ej(0) is the initial energy, rj is the data transmission rate, αj1 is a distance-independent parameter, αj2 is a distance-dependent parameter of the j-th AN, and d ijn is the n-order Euclidean distance from the i-th particle (BS) to the j-th AN. Step 5: Calculate the (N-K+1)-th minimal lifetime among all the ANs for the i-th particle as its fitness value (fitness(i)) by the following formula: N. fitness(i ) = Min N − K +1{lij } , j =1. where N is number of ANs, K is the allowed number of alive ANs, i = 1 to n, and j=1 to N. Step 6: Set pBesti as the current i-th particle if the value of fitness(i) is larger than the current fitness value of pBesti. Step 7: Set gBest as the best pBest among all the particles. That is, let: fitness of pBestk = maxin=1 fitness of pBesti,. 28.
(37) and set gBest=pBestk. Step 8: Update the velocity of the i-th particle as: Vidnew = w × Vidold + c1 × Rand () × ( pBestid − xid ) + c 2 × Rand () × ( gBest − xid ) , 1. 2. d. where Vidnew is the new velocity of the i-th particle at the d-th dimension, V idold is the current velocity of the i-th particle at the d-th dimension, w is the. inertial weight, c1 is the acceleration constant for particles moving to pBest, c2 is the acceleration constant for particles moving to gBest, Rand1() and Rand2() are two random numbers among 0 to 1, xid is the current position of the i-th particle at the d-th dimension, pBestid is the value of pBesti at the d-th dimension, and gBestd is the value of gBest at the d-th dimension. Step 9: Update the position of the i-th particle as:. x new = x old + V idnew , id. id. new where xid and xidold are respectively the new position and the current. position of the i-th particle at the d-th dimension. Step 10: Repeat Steps 4 to 9 until the termination conditions are satisfied.. In Step 10, the termination conditions may be predefined execution time, a fixed number of generations or when the particles have converged to a certain threshold.. 29.
(38) 5.2 An Example. In this section, a simple example in a two-dimensional space is given to explain how the PSO approach can be used to find the best BS location for the K-of-N lifetime problem. Assume there are totally four ANs in the example and their initial parameters are shown in Table 9, where “Location” represents the two-dimensional coordinate position of an AN, “Rate” represents the data transmission rate, and “Power” represents the initially allocated energy. All αj1’s are set at 0 and all αj2’s at 1 for simplicity. Also assume the allowed number K of alive ANs is 3.. Table 9: The initial parameters of ANs in the example AN Location Rate Power 1. (1, 10). 3. 10000. 2. (11, 0). 5. 10000. 3. (8, 7). 4. 6400. 4. (4, 3). 4. 6400. For the example, the proposed PSO algorithm proceeds as follows.. Step 1: The initial fitness values of all pBests and the gBest are set to zero. Step 2: A group of n particles are generated at random. Assume n is set at 3 in this example for simplicity. Also assume the three initial particles randomly. 30.
(39) generated are located at (4, 7), (9, 5) and (6, 4). Figure 6 shows the positions of the given ANs and the initial particles, where the triangles represent the particles and the circles represent the ANs.. 12 11 10. 1. 9 8 7. 3. 1. 6 5. 2. 4. 3. 3. 4. 2 1 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 2 11. 12. Figure 6: The positions of the given ANs and the initial particles. Step 3: An initial velocity is randomly generated for each particle. In this example assume the initial velocity is set at zero for simplicity. Step 4: The lifetime of each AN for a particle is calculated. Take the first AN for the first particle as an example. Its lifetime is calculated as follows: l11 = 10000 3[(4 − 1) 2 + (7 − 10) 2 ] = 185.18 .. The lifetimes of all ANs for all particles are shown in Table 10.. 31.
(40) Table 10: The lifetimes of all ANs for all particles Particle. AN. 1(1, 10) 2(11, 0) 3(8, 7) 4(4, 3). 1(4, 7). 185.18. 20.40. 100. 100. 2(9, 5). 37.45. 68.96. 320. 55.17. 3(6, 4). 54.64. 48.78. 123.07. 320. Step 5: The (N-K+1)-th minimal lifetime among all the ANs for each particle is calculated as its fitness value. Take the first particle as an example. Its fitness is calculated as follows:. Fitness(1) = Min(4-3+1){l11, l12, l13, l14}. = Min(4-3+1){185.18, 20.41, 100, 100}. = 100.. In the same way, the fitness values of all the particles are calculated and shown in Table 11.. Table 11: The fitness values of all the particles Particle Location Fitness 1. (4, 7). 100. 2. (9, 5). 55.17. 3. (6, 4). 54.64. Step 6: The fitness value of each particle is compared with that of its corresponding. 32.
(41) pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. In the first generation, the fitness values of all the pBests are zero, smaller than those of the particles. The particles are then stored as the new pBests. The resulting pBests are shown in Table 12, where the field “appearance generation” represents the generation number in which a particle is set as the current pBest.. Table 12: The pBests after the first generation Particle Location Fitness. Appearance Generation. 1. (4, 7). 100. 1. 2. (9, 5). 55.17. 1. 3. (6, 4). 54.64. 1. Step 7: The best pBesti among all the particles is chosen as the gBest. In this example, pBest1 has the largest fitness value and is set as the gBest. Step 8: The new velocity of each particle is updated. Assume the inertial weight w is set at 1, the acceleration constant c1 for particles moving to pBest is set at 2, and the acceleration constant c2 for particles moving to gBest is set at 2. Take the second particle as an example to illustrate the step. Its new velocity is calculated as follows: old V 2new x = w × V 2 x + c1 × Rand 1 () × ( pBest 2 x − x 2 x ) + c2 × Rand 2 () × ( gBestd − x2x ). 33.
(42) =1*0+2*0.5(9-9)+2*0.25(4-9) = -2.5, and old V 2new y = w × V 2 y + c1 × Rand 3 () × ( pBest 2 y − x 2 y ) + c2 × Rand 4 () × ( gBest d − x2 y ). =1*0+2*1(5-5)+2*0.125(7-5) = 0.5, where the four random numbers generated are 0.5, 0.25, 1 and 0.125, respectively. In the same way, the new velocities of the other two particles can be calculated. The results are shown in Table 13.. Table 13: The new velocities of all the three particles Particle Old Location. Velocity. 1. (4, 7). (0, 0). 2. (9, 5). (-2.5, 0.5). 3. (6, 4). (-1.2, 2.4). Step 9: The position of each particle is updated. Take the second particle as an example. Its new position is calculated as follows: x 2new = x 2oldx + V 2new x x. = 9 + (-2.5) = 6.5, and x 2new = x 2oldy + V 2new y y = 5 + 0.5 34.
(43) = 5.5. In the same way, the new positions of all the other two particles can be found. The results are shown in Table 14.. Table 14: The new positions of all the three particles Particle Old Location. Velocity. New Location. 1. (4, 7). (0, 0). (4, 7). 2. (9, 5). (-2.5, 0.5). (6.5, 5.5). 3. (6, 4). (-1.2, 2.4). (4.8, 6.4). Step 10: Steps 4 to 9 are then repeated until the termination conditions are satisfied. The lifetime evolution along with different generations for this example is shown in Figure 7.. Lifetime. 150 100 50 0 0. 20. 40 60 Generations. 80. 100. Figure 7: The evolution of the system lifetime for the example.. In this example, the solutions converge after about 70 generations. The solution. 35.
(44) was located at (4.5515, 6.419) and its lifetime was 130.8344 time units.. 36.
(45) CHAPTER 6 A General PSO Algorithm for the m-in-K-of-N Lifetime Problem. 6.1 Algorithm. In this section, a heuristic algorithm based on PSO to solve the m-in-K-of-N lifetime problem under general constraints is proposed. An initial set of particles is first randomly generated, with each particle representing a possible BS location. Each particle is also allocated an initial velocity for changing its state. Let ej(0) be the initial energy, rj be the data transmission rate, αj1 be the distance-independent parameter, and αj2 be the distance-dependent parameter of the j-th AN. The lifetime lij of an application node ANj for the i-th particle is calculated by the following formula: lij = e j (0) rj (α j + α j d ijn ) ,. (10). where d ijn is the n-order Euclidian distance from the j-th AN to the i-th particle. In the m-in-K-of-N lifetime problem, given N ANs, the system survives as long as all the m predefined supporting (necessary) ANs are alive and overall at least K ANs are alive, K≧m. Restated, the system fails when at least N-K+1 and any one of all the m predefined supporting ANs run out of energy. Let the set of m predefined supporting. 37.
(46) ANs denoted as Sm. The fitness function used for evaluating the i-th particle is thus shown below: N. fitness (i ) = Min{Min{l ij }, Min j∈S m. j =1, j∉S m. N − K +1. {lij }} .. (11). That is, the fitness of the i-th particle is the smaller value of the minimal lifetime among the nodes within the support set Sm and the (N-K+1)-th minimal lifetime among the nodes not within Sm. A larger fitness value thus denotes a better solution quality for the m-in-K-of-N lifetime problem, meaning the corresponding BS location is better. The fitness value of each particle is then compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. The best pBesti among all the particles is chosen as the gBest. Besides, each particle has a velocity, which is used to change the current position. All particles thus continuously move in the search space. When the termination conditions are achieved, the final gBest will be output as the location of the base station. The proposed algorithm is stated below.. The proposed PSO algorithm for the m-in-K-of-N lifetime problem: Input: A set of N ANs, each ANj with its location (xj, yj), data transmission rate rj, initial energy ej(0), parameter αj1, parameter αj2, the allowed number K of alive ANs, and the set Sm of m predefined supporting ANs.. 38.
(47) Output: A BS location that will cause a nearly maximal lifetime for the m-in-K-of-N lifetime problem. Step 1: Initialize the fitness values of all pBests and the gBest to zero. Step 2: Randomly generate a group of n particles, each representing a possible BS location. Locations may be two-dimensional or three-dimensional, depending on the problems to be solved. Step 3: Randomly generate an initial velocity for each particle. Step 4: Calculate the lifetime lij of the j-th AN for the i-th particle by the following formula: lij = e j (0) r j (α j1 + α j 2 d ijn ),. where ej(0) is the initial energy, rj is the data transmission rate, αj1 is a distance-independent parameter, αj2 is a distance-dependent parameter of the j-th AN, and d ijn is the n-order Euclidean distance from the i-th particle (BS) to the j-th AN. Step 5: Find the smaller value of the minimal lifetime among the nodes within the support set Sm and the (N-K+1)-th minimal lifetime among the nodes not within Sm for the i-th particle as its fitness value (fitness(i)) by the following formula: N. fitness (i ) = Min{Min{lij }, Min j∈S m. 39. j =1, j∉S m. N − K +1. {lij }} ,.
(48) where N is number of ANs, K is the allowed number of alive ANs, Sm is the set of supporting ANs, i = 1 to n, and j = 1 to N. Step 6: Set pBesti as the current i-th particle if the value of fitness(i) is larger than the current fitness value of pBesti. Step 7: Set gBest as the best pBest among all the particles. That is, let: fitness of pBestk = maxin=1 fitness of pBesti, and set gBest=pBestk. Step 8: Update the velocity of the i-th particle as: Vidnew = w × Vidold + c1 × Rand () × ( pBestid − xid ) + c 2 × Rand () × ( gBest − xid ) , 1. 2. d. where Vidnew is the new velocity of the i-th particle at the d-th dimension, V idold is the current velocity of the i-th particle at the d-th dimension, w is the. inertial weight, c1 is the acceleration constant for particles moving to pBest, c2 is the acceleration constant for particles moving to gBest, Rand1() and Rand2() are two random numbers among 0 to 1, xid is the current position of the i-th particle at the d-th dimension, pBestid is the value of pBesti at the d-th dimension, and gBestd is the value of gBest at the d-th dimension. Step 9: Update the position of the i-th particle as:. x new = x old + V idnew , id. id. new where xid and xidold are respectively the new position and the current. 40.
(49) position of the i-th particle at the d-th dimension. Step 10: Repeat Steps 4 to 9 until the termination conditions are satisfied.. In Step 10, the termination conditions may be predefined execution time, a fixed number of generations or when the particles have converged to a certain threshold.. 6.2 An Example. In this section, a simple example in a two-dimensional space is given to explain how the PSO approach can be used to find the best BS location for the m-in-K-of-N lifetime problem. Assume there are totally six ANs in the example and their initial parameters are shown in Table 15, where “Location” represents the two-dimensional coordinate position of an AN, “Rate” represents the data transmission rate, and “Power” represents the initially allocated energy. All αj1’s are set at 0 and all αj2’s at 1 for simplicity. Also assume the allowed number K of alive ANs is 4 and the supporting set of ANs is {AN5 and AN6} (m is thus 2).. 41.
(50) Table 15: The initial parameters of ANs in the example AN Location Rate Power 1. (1, 10). 3. 10000. 2. (11, 0). 5. 10000. 3. (8, 7). 4. 6400. 4. (4, 3). 4. 6400. 5. (2, 4). 3. 8200. 6. (6, 9). 5. 8200. For the example, the proposed PSO algorithm proceeds as follows.. Step 1: The initial fitness values of all pBests and the gBest are set to zero. Step 2: A group of n particles are generated at random. Assume n is set at 3 in this example for simplicity. Also assume the three initial particles randomly generated are located at (4, 7), (9, 5) and (6, 4). Figure 8 shows the positions of the given ANs and the initial particles, where the triangles represent the particles and the circles represent the ANs.. 42.
(51) 12 11 10. 1 6. 9 8 7. 3. 1. 6 5. 2. 4. 3. 5. 3. 4. 2 1 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 2 11. 12. Figure 8: The positions of the given ANs and the initial particles. Step 3: An initial velocity is randomly generated for each particle. In this example assume the initial velocity is set at zero for simplicity. Step 4: The lifetime of each AN for a particle is calculated. Take the first AN for the first particle as an example. Its lifetime is calculated as follows: l11 = 10000 3[(4 − 1) 2 + (7 − 10) 2 ] = 185.18 .. The lifetimes of all ANs for all particles are shown in Table 16.. Table 16: The lifetimes of all ANs for all particles Particle. AN. 1(1, 10) 2(11, 0) 3(8, 7) 4(4, 3) 5(2, 4) 6(6, 9). 1(4, 7). 185.18. 20.4. 100. 100. 210.25. 205. 2(9, 5). 37.45. 68.96. 320. 55.17. 54.66. 65.6. 3(6, 4). 54.64. 48.78. 123.07. 320. 170.83. 65.6. 43.
(52) Step 5: The smaller value of the minimal lifetime among the nodes within the support set Sm and the (N-K+1)-th minimal lifetime among the nodes not within Sm for each particle is found as its fitness value. Take the first particle as an example. Its fitness is calculated as follows:. Fitness(1) = Min{Min{210.5, 205}, Min(4-2+1){185.18, 20.41, 100, 100}}. = Min{205, 100}. = 100.. In the same way, the fitness values of all the particles are calculated and shown in Table 17.. Table 17: The fitness values of all the particles Particle Location Fitness 1. (4, 7). 100. 2. (9, 5). 54.66. 3. (6, 4). 65.6. Step 6: The fitness value of each particle is compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. In the first generation, the fitness values of all the pBests are zero, smaller than those of the particles. The 44.
(53) particles are then stored as the new pBests. The resulting pBests are shown in Table 18, where the field “appearance generation” represents the generation number in which a particle is set as the current pBest.. Table 18: The pBests after the first generation Particle Location Fitness. Appearance Generation. 1. (4, 7). 100. 1. 2. (9, 5). 54.66. 1. 3. (6, 4). 65.6. 1. Step 7: The best pBesti among all the particles is chosen as the gBest. In this example, pBest1 has the largest fitness value and is set as the gBest. Step 8: The new velocity of each particle is updated. Assume the inertial weight w is set at 1, the acceleration constant c1 for particles moving to pBest is set at 2, and the acceleration constant c2 for particles moving to gBest is set at 2. Take the second particle as an example to illustrate the step. Its new velocity is calculated as follows: old V 2new x = w × V 2 x + c1 × Rand 1 () × ( pBest 2 x − x 2 x ) + c2 × Rand 2 () × ( gBestd − x2 x ). =1*0+2*0.5(9-9)+2*0.25(4-9) = -2.5, and old V 2new y = w × V 2 y + c1 × Rand 3 () × ( pBest 2 y − x 2 y ) + c2 × Rand 4 () × ( gBest d − x2 y ). 45.
(54) =1*0+2*1(5-5)+2*0.125(7-5) = 0.5, where the four random numbers generated are 0.5, 0.25, 1 and 0.125, respectively. In the same way, the new velocities of the other two particles can be calculated. The results are shown in Table 19.. Table 19: The new velocities of all the three particles Particle Old Location. Velocity. 1. (4, 7). (0, 0). 2. (9, 5). (-2.5, 0.5). 3. (6, 4). (-1.2, 2.4). Step 9: The position of each particle is updated. Take the second particle as an example. Its new position is calculated as follows: x 2new = x 2oldx + V 2new x x. = 9 + (-2.5) = 6.5, and x 2new = x 2oldy + V 2new y y = 5 + 0.5 = 5.5. In the same way, the new positions of all the other two particles can be found. The results are shown in Table 20. 46.
(55) Table 20: The new positions of all the three particles Particle Old Location. Velocity. New Location. 1. (4, 7). (0, 0). (4, 7). 2. (9, 5). (-2.5, 0.5). (6.5, 5.5). 3. (6, 4). (-1.2, 2.4). (4.8, 6.4). Step 10: Steps 4 to 9 are then repeated until the termination conditions are satisfied. The lifetime evolution along with different generations for this example is shown in Figure 9.. 180 160 140 120. Lifetime. 100 80 60 40 20 0 0. 20. 40. 60. 80. 100. Generations. Figure 9: The evolution of the system lifetime for the example. In this example, the solutions converge after about 70 generations. The solution was located at (5.2718, 5.8857) and its lifetime was 160.3215 time units.. 47.
(56) CHAPTER 7 A General PSO Algorithm for Allocation of Multiple Base Stations. 7.1 Algorithm. In this section, the problem for allocation of base stations is considered. A heuristic algorithm based on PSO to search for the locations of multiple base stations under general constraints is thus proposed. An initial group of particles is first randomly generated, with each particle representing a set of possible base-station locations. Each particle is also allocated an initial velocity for changing its state. Let ej(0) be the initial energy, rj be the data transmission rate, αj1 be the distance-independent parameter, and αj2 be the distance-dependent parameter of the j-th AN. The lifetime li(k)j of an application node ANj communicating with the k-th location in the i-th particle is calculated by the following formula:. l i ( k ) j = e j (0) r j (α j1 + α j 2 d in( k ) j ) , where. d in( k ) j. (12). is the n-order Euclidian distance from the j-th AN to the k-th location in. the i-th particle. Assume there are M base stations to be allocated. The lifetime lij of ANj for the i-th particle is calculated by the following formula:. 48.
(57) M. lij = Max{li ( k ) j } . k =1. (13). The fitness function used for evaluating each particle is thus shown below: N. fitness (i ) = Min{lij }, j =1. (14). where N is the number of ANs. That is, each particle takes the minimal lifetime of all ANs as its fitness value. A larger fitness value denotes a longer lifetime of the whole system, meaning the corresponding base station locations are better. The fitness value of each particle is then compared with that of its corresponding pBest. If the fitness value of the i-th particle is larger than that of pBesti, pBesti is replaced with the i-th particle. The best pBesti among all the particles is chosen as the gBest. Besides, each particle has a velocity, which is used to change the current position. All particles thus continuously move in the search space. When the termination conditions are achieved, the final gBest will be output as the locations of the multiple base stations. The proposed algorithm is stated below.. The proposed PSO algorithm for allocation of multiple base stations: Input: A set of N ANs, each ANj with its location (xj, yj), data transmission rate rj, initial energy ej(0), parameter αj1, and parameter αj2. Output: M base-station locations that will cause a nearly maximal lifetime for the system.. 49.
(58) Step 1: Initialize the fitness values of all pBests and the gBest to zero. Step 2: Randomly generate a group of n particles, each particle representing a possible solution of M base-station locations. Locations may be two-dimensional or three-dimensional, depending on the problems to be solved. Step 3: Randomly generate an initial velocity for each particle. Step 4: Calculate the lifetime li(k)j of the j-th AN communicating with the k-th base station in the i-th particle by the following formula: li ( k ) j = e j (0) r j (α j1 + α j 2 d in( k ) j ),. where ej(0) is the initial energy, rj is the data transmission rate, αj1 is a distance-independent parameter, αj2 is a distance-dependent parameter of the j-th AN, and d in( k ) j is the n-order Euclidean distance from the k-th base station of the i-th particle to the j-th AN. Step 5: Calculate the maximal lifetime lij of the j-th AN for the i-th particle by the following formula: M. lij = Max{li ( k ) j } . k =1. Step 6: Calculate the lifetime of the whole sensor system for the i-th particle as its fitness value (fitnessi) by the following formula: N. fitness (i ) = Min lij , j =1. where N is number of ANs and i = 1 to n.. 50.
(59) Step 7: Set pBesti as the current i-th particle if the value of fitness(i) is larger than the current fitness value of pBesti. Step 8: Set gBest as the best pBest among all the particles. That is, let: fitness of pBestq = maxin=1 fitness of pBesti, and set gBest=pBestq. Step 9: Update the velocity of the i-th particle as: old , Vinew (k )d = w ×Vi(k )d + c1 × Rand () × ( pBesti(k )d − xi(k )d ) + c 2 × Rand 2 () × ( gBest kd − xi ( k ) d ) 1. where Vi (new k ) d is the new velocity of the k-th base station at the d-th dimension for the i-th particle, V i old is the current velocity of the k-th base station at the (k )d d-th dimension for the i-th particle, w is the inertial weight, c1 is the acceleration constant for particles moving to pBest, c2 is the acceleration constant for particles moving to gBest, xi(k)d is the current position of the k-th base station at the d-th dimension for the i-th particle, pBesti(k)d is the value of the k-th base station of pBesti at the d-th dimension, and gBestkd is the value of the k-th base station of gBest at the d-th dimension, Rand1() and Rand2() are two random numbers among 0 to 1. Step 10: Update the position of the i-th particle as: x new. i(k )d. = x old. i(k )d. + V i new (k )d ,. new where xi(k)d and xiold ( k ) d are respectively the new position and the current. 51.
(60) position of the k-th base station at the d-th dimension for the i-th particle. Step 11: Repeat Steps 4 to 10 until the termination conditions are satisfied.. In Step 11, the termination conditions may be predefined execution time, a fixed number of generations or when the particles have converged to a certain threshold.. 7.2 An Example. In this section, a simple example in a two-dimensional space is given to explain how the PSO approach can be used to find the multiple base-station locations that will generate the nearly maximal lifetime in the whole system. Assume there are totally four ANs in this example and their initial parameters are shown in Table 21, where “Location” represents the two-dimensional coordinate position of an AN, “Rate” represents the data transmission rate, and “Power” represents the initially allocated energy. All αj1’s are set at 0 and all αj2’s at 1 for simplicity.. 52.
(61) Table 21: The initial parameters of ANs in the example AN Location Rate Power 1. (1, 10). 5. 10000. 2. (11, 0). 5. 10000. 3. (8, 7). 4. 6400. 4. (4, 3). 4. 6400. For the example, the proposed PSO algorithm proceeds as follows.. Step 1: The initial fitness values of all pBests and the gBest are set to zero. Step 2: A group of n particles are generated at random and each particle has m locations of base stations. Assume n is set at 3 and m is set at 2 in this example for simplicity. Also assume the three initial particles randomly generated are located at {(8, 8), (0, 6)}, {(11, 11), (5, 8)}, and {(6, 9), (5, 3)}. Figure 10 shows the positions of the given ANs and the initial particles, where the triangles represent the particles and the circles represent the ANs.. 53.
(62) 12 2a. 11 10. 1 3a. 9 8. 1a. 2b. 7. 3. 6 1b 5 4 3. 4. 3b. 4. 5. 2 1 0. 1. 2. 3. 6. 7. 8. 9. 10. 2 11. 12. Figure 10: The positions of the given ANs and the initial particles. Step 3: An initial velocity is randomly generated for each particle. In this example assume the initial velocity is set at zero for simplicity. Step 4: The lifetime of each AN for a base station of the particle is calculated. Take the first AN communicating with the first base station of the first particle as an example. Its lifetime is calculated as follows: l1(1)1 = 10000 5[(8 − 1) 2 + (8 − 10) 2 ] = 37.7358 .. The lifetimes of all ANs communicating with all base stations in the three particles are shown in Table 22.. 54.
相關文件
• However, these studies did not capture the full scope of human expansion, which may be due to the models not allowing for a recent acceleration in growth
Have shown results in 1 , 2 & 3 D to demonstrate feasibility of method for inviscid compressible flow problems. Department of Applied Mathematics, Ta-Tung University, April 23,
Describe finite-volume method for solving proposed model numerically on fixed mapped (body-fitted) grids Discuss adaptive moving mesh approach for efficient improvement of
during daytime. The barn owl is endangered because people are moving to barns and also because mice eat chemicals and the owls eat the mice and they die. 57). Stage 2:
Then, it is easy to see that there are 9 problems for which the iterative numbers of the algorithm using ψ α,θ,p in the case of θ = 1 and p = 3 are less than the one of the
Using this formalism we derive an exact differential equation for the partition function of two-dimensional gravity as a function of the string coupling constant that governs the
The existence of cosmic-ray particles having such a great energy is of importance to astrophys- ics because such particles (believed to be atomic nuclei) have very great
We must assume, further, that between a nucleon and an anti-nucleon strong attractive forces exist, capable of binding the two particles together.. *Now at the Institute for