{'fraction_non_alphanumeric': 0.028583709434773265, 'fraction_numerical': 0.009527903144924422, 'mean_word_length': 4.521954113924051, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
PIR Sensors Deployment with the Accessible Priority in Smart Home Using Genetic Algorithm

In smart home, location estimation based on PIR sensors is very popular. Existing methods by various sensors technologies and intelligent algorithms are used to achieve a high accuracy. In fact, how to deploy the PIR sensor is directly related to the accuracy. In this paper, we present an approach to deploying the PIR sensor based on the accessible priority by genetic algorithm. This paper presents a genetic algorithm that searches for an optimal or near optimal solution to the PIR sensor deployment for smart home. The fitness function of GA is based on the accessible priority of indoor areas. The accessible priority value of different area is set according to the indoor environment and daily accessible habits. The performance of the genetic algorithm was evaluated using several metrics, and the simulation results demonstrated that the proposed algorithm can optimize the network coverage in terms of accessible frequency.


Introduction
According to the United Nations online database [1], currently the percentage of elderly population is 7.6% that is projected to rise by 16.2% in 2050. Issues such as increased healthcare expenditure, burden to caregivers, and insufficient and inefficient care are more likely to occur as the health of older persons normally deteriorates with increasing age, resulting in more demand for long-term care. Therefore, it becomes urgent to find a compromise between the need for constant care (at home or in institutions) and the need to lighten the load on caregivers. Also, it is highly important to ensure that the ministered care is personalized and efficient. In this regard, the smart home concept is an adequate solution. It can be especially useful for the elderly or the disabled who wish to live independently.
In smart home, the occupant's location is probably one of the most important data items needed to monitor the occupant's activities [2]. Some home devices, such as lighting, heating, or home electronic devices, should be also adjusted automatically according to occupant's indoor position. So, it is necessary to localize people in smart home by sensor technologies and some intelligent methods. When the sensors are used for indoor localization, some techniques and constraints need to be considered, such as the occupant's privacy [3], hardware installment cost [4], and technologies' unobtrusiveness [5]. For PIRs are costly, have no privacy problem, and also have very low power consumption, they are very useful to track targets in indoor environment. In Gopinathan et al. 's paper, four PIR detectors are used to develop a system able to detect the path of a single person moving in an area [6], while in Shankar et al. 's paper a low cost sensor cluster is used to extract velocity as well as the path of a single person [7]. Also an array of PIR is used to detect the number of people moving through a gate [8]. In order to improve the tracking accuracy, some efforts are placed on position calculation by data fusion algorithms. Kim et al. developed a Bayesian classifier to enhance the accuracy of PIR-based indoor locationaware system [9]. Seifzadeh et al. proposed a Soft-Data-Constrained Multimodel Particle Filtering method, where the inherently vague (subjective) soft data provided by human agents are modeled using a fuzzy inference system [10]. 2 International Journal of Distributed Sensor Networks These mentioned Bayesian methods offer a formal way to update existing knowledge from new evidence. Slightly finer localization can be obtained by exploiting the deployment of neighboring sensors. However, there are a limited number of studies that focus on coverage efficiency of PIR sensors. In this paper, we propose an implementation of GA-based approach for the PIR sensors deployment based on the priority of zones by accessible frequency in a smart home. We split the indoor environment in 2D view into small grids, and we assign a value to every grid that indicates the priority (accessible frequency) of the zone specified by that grid. For example, in a smart home there are many areas with different accessible frequencies. We can distinguish these areas based on obstacles (walls), furniture, the unoccupied free place, accessible daily habits, and so forth. The performance of a given PIR sensor layout by genetic algorithm was evaluated according to the area accessibility as the standard. Some simulation experiments have been implemented to evaluate the performance of our method for PIR deployments.
The rest of the paper is organized as follows: Section 2 will review related sensor deployment works. Section 3 will provide the description of the genetic algorithm with steps. Section 4 will discuss the experimental results and some simulation regarding the algorithm. Finally, Section 5 concludes this paper.

Related Works
This paper focused on the optimal PIR sensor placement with the accessible priority using GA-based approach for indoor localization. Therefore, the review of the related work consists of two parts: PIR sensor placement for indoor localization and GA for sensor placement.

PIR Sensor Placement for Indoor Localization.
Generally, the PIR sensor placement is classified into two categories: (1) the deployment of PIR sensors: selecting the optimal coordinate for the PIR sensors and (2) the modulation of FOVs: modulating the optimal FOVs. In [11], the authors have mentioned that the deployment strategy of directional sensor nodes is critical to improve target detection and tracking accuracy. They presented the PIR sensor deployment in WSNs based on computational geometry. Byunghun and his workmates also show how the PIR sensors are deployed, which is very important for localizing an object using regionbased tracking algorithm [12]. They discussed the PIR deployment that would divide the monitored room into different regions and how to deploy them determined the localization error. The work reported in [13] addresses the problem of target detection and classification using seismic and PIR sensors and makes use of wavelet-based feature extraction method to resolve this problem. The advantages and disadvantages of seismic and PIR sensors are also discussed. For example, the deployment of sensors largely depends on the intent of use and environment. PIR sensor deployment could be very expensive, because the detection range of PIR sensors has a short range of detection. Therefore, it is recommended that seismic and PIR sensor should be used together. In [14], PIR sensor nodes are deployed linearly and the sensing area is divided into cells through the four sensing regions of each PIR sensor node. In another study [15], five PIR sensors are attached to a service robot to make a circular sensing region. According to the experimental results stated in these studies, the usage of PIR sensors can improve the accuracy of target detection and tracking. Unlike real sensor nodes, most of the researches assume that sensor nodes have a 360 ∘ Angle of View (AoV). For example, a node deployment strategy that assumes PIR sensor nodes have 360 ∘ AoV is proposed in [7]. The performance of the proposed deployment algorithm is evaluated by comparing the coverage at the initial and final locations of sensor nodes.

GA for Sensor Placement.
Sensor placement for indoor localization is an optimization problem that is nondeterministic and polynomial-time hard [16]. Genetic algorithms (GAs) are a type of evolutionary, optimization algorithm, which can be used to solve optimization problems with NPhard complexity. Some previously developed algorithms have used GAs to obtain optimum deployment of sensor networks. The study in [17] presents a multiobjective genetic algorithm (MOGA) for optimal deployment of static sensors in a 2D flat RoI, with two competing deployment objectives: maximizing the area coverage and maximizing lifetime. Each deployment layout was ranked according to its area coverage and lifetime. Different optimum layouts are obtained with respect to different sensing-to-communication range ratios. Reference [18] proposes a dynamic sensor nodes selection strategy, which uses the GA to implement global searching space of GA and ensure the validity of each chromosome. The two objectives of their fitness function are to maximize the coverage and minimize the area covered by more than one sensor. Liang et al. [19] have performed the optimization work for wireless sensor networks in 3D environments. In this work, a force driven genetic algorithm was introduced to decide the location of the sensors in order to obtain an optimized accessible space and also consider sensor coverage. Feng et al. propose an implementation of GA-based design approach for the deployment of the sensors and angles for the modulation of FOVs [20].

An Approach for Deploying PIR Sensor Using Genetic Algorithm
This section describes the approach that we propose to deal with the deployment issue of PIR-based positioning system. Two subsections are included in this part. Section 3.1 describes how the proposed approach is used to build the accessible map based on the human visiting habits. And Section 3.2 illustrates how our approach is used to optimally deploy the PIR sensors with the accessible priority of each area in indoor environment.

Building Accessible Map by Human Daily Habits.
Given a mock apartment for deploying, our approach for building an accessible map is executed by human daily habits by performing the following steps, as illustrated in Figure 1. Step 1. The full description of space topography of the smart home to be monitored is provided, shown as in Figure 1(a). This includes shape and size of the room layout, location of walls and furniture, and size of the areas in which the indoor environment is partitioned.
Step 2. The graphical characterization of the space topography is transformed into an accessible map, which can be used to resolve the accessible priority of each area in the smart home.
Step 3. The accessible map is provided as input of the GA so as to find as output the accessible priority in each area of the smart home. The image of the accessible map is resolved as follows.
Step 3.1. The space topography is fixed for a given indoor environment. If some places are occupied by the walls or furniture such as beds, chairs, or refrigerators, people do not or rarely visit these positions. So the areas of the accessible map occupied by walls or furniture are set as "0." For other areas without the furniture and other obstacles, the initial value of the accessible map is set as "0.5." The results are shown as in Figure 1(b).
Step 3.2. For the accessible areas in the smart home, not all positions have the same opportunities to be visited. We use another source of information, that is, the daily visiting habits of human subject when he interacts with the environment. Generally, the human subject visits more frequently around certain furniture. The mock apartment we designed has some key furniture: bedroom bed, living room couch, dining room chair, living room table, kitchen basin, and bathroom sink. The areas around the furniture have more visiting frequencies than other inner areas in the indoor environment.
Step 3.3. Each two pieces of furniture can generate arbitrary route. Some daily routes are trained by A * algorithm [21].
The starting and ending landmarks can be (p1) entrance to kitchen, (p2) kitchen to living room table, (p3) major bedroom to guest room, (p4) living room sofa to bathroom, and (p5) guest room to balcony, shown as in Figure 1(c). Tests with different trajectories were processed. The areas in these trajectories have more accessible frequencies than other areas of the apartment. These values can be obtained by observation.
Step 3.4. The last consideration is for transitions between the accessible areas and their surrounding areas. The accessible map value can be computed by convolution of the accessibility with a Gaussian kernel in two dimensions. The mean of the Gaussian kernel is the related wall's position minus/plus 0.2 m, and the variance of the Gaussian kernel is 0.2 m. The equation can be described by Step 4. Based on the prior knowledge, the accessible map can be represented in Figure 1(d). The accessible map is discredited by the assumed occupant visits respective grid points. Each grid size is Δ × Δ , and Δ = Δ = 0.2 m. The digital binary grey image of the heat "map" is shown as in Figure 1(d), denoted by the matrix . Each element ( , ) denotes the "heat" score of the th grid point for deployed space if That means the th grid point can be accessible. Then we generate the array to save the coordinate where ∈ [1, ], in which is denoted by the accessible number of the deployed space. These array values will be used in the formulation of the optimization problem.

PIR Sensors Optimal Deployment
Based GA-Based Algorithm. Genetic algorithm (GA) is a stochastic search technique that mimics the natural evolution proposed by Charles Darwin in 1858 [22]. GA has been successfully applied to a wide range of combination problems. It is modeled largely on the principles of the evolution via natural selection [23], employing a population of individuals that carry on the selection procedure in terms of variation-inducing operators such as mutation and recombination (crossover). A fitness function is used to evaluate individuals, and reproductive success varies with fitness. The main objective of employing the GA in our approach is to enhance the performance of the indoor location after initial deployment of the stationary nodes. The details are described as follows.

PIR Sensor Parameters.
The interested parameters of the PIR sensing model are represented with the use of a vector : where the th PIR sensor is placed on ( , , ) and the FOV of th PIR sensor is denoted by . The PIR sensors are all fixed on the same ceiling and therefore omit the -coordinate. If the -coordinate is fixed, the FOV of the PIR sensor can be denoted by the radius of sensing circle area. The PIR sensing area in our setup is modeled as a circle on the floor with a radius of 1 m. So the parameters of PIR deployment can be simply represented as

Chromosomes
where denotes the number of PIR sensors deployed and the gen denotes each PIR location code in the deployed plane, where 1 ≤ ≤ : For example, the grid of = 11 represents PIR node mapped to the location (3,3) in -plane; the corresponding chromosome is shown in Figure 2.

Fitness Function.
The fitness function is used in order to choose the best fittest chromosomes for the purpose of reproduction of the next generated solutions by the GA. In our approach, the fitness function calculates the sum of "heat" scores for each grid point in the -plane of the specific space. The "heat" score ℎ equals the visiting frequency of each grid from the accessible map. Then the sum of all grids heat scores is calculated by decreasing plus strategy, which means the value of heat score is decreased by 1 if the coverage level increased and one limitation requirement is that the coverage level number is not greater than the hot rank of the position. Then this fitness function is given by where ℎ ( ) denotes the number of the accessible grid points in the accessible map, V ( ) is the number of PIRs · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · (1, 1) (2, 2) which covered the th grid point, and ( ) denotes the heat score rank of the th grid point.
According to randomness and parallelism of evolution individual for PIR layouts, the overlapping probability of multiple PIRs sensing area is large. For this reason, the restriction condition for the number num ( ) of overlapping PIR of the th grid point is set. That means if num ( ) is greater than the maximum of threshold max , some punishments have been made. So the fitness function can be modified as In this way, the problem of the optimal sensor deployment is formulated as maximize .
In order to avoid the prematurity of the population evolution phenomenon and keep the diversity of population, the fitness function is processed by the power function compression. Then the final expression of the fitness function is

GA Selection.
We use Roulette Wheel Selection (RMS) as the selection method, which gives to each individual of the current population a probability of being selected [10], proportional to its fitness ( ): where denotes the population size in terms of the number of individuals. We used the fitness ratio calculated in (13) as a measure for ranking the chromosomes and then performing parent selection according to the ratio participated by each chromosome in the fitness function. The chromosomes with higher ranking have a higher probability to become parents and perform reproduction of new individuals than others with smaller ranking. This property must be maintained in order to increase the improvement ratio at each generation of the GA .  12  60  40  89  3  79  21  30  45   12  20  44  80  6  33  42  9  90   12  60  40  89  3  47  36  15  45   12  20  40  80  6  65  27  24

GA Operator Operations
(a) Crossover. The crossover operator is a genetic operator that combines (mates) two chromosomes (parents) to produce a new chromosome (offspring). Arithmetic crossover (AC) operator is used for GA in our approach. Children are the weighted arithmetic mean of two parents. Children are feasible with respect to linear constraints and bounds. Alpha is random value in [0, 1]. If parent 1 and parent 2 are the parents and parent 1 has better fitness value, the function returns the child and the formula is expressed in (14) Figure 3 shows the example of the arithmetic crossover operator by alpha = 0.3. Crossover occurs during evolution according to a userdefinable crossover probability .
is increased when the population tends to get stuck at a local optimum and decreased when the population is scattered in the solution space. Here is defined as follows: where avg is an average fitness value of the population, max is maximum fitness value of the population, is the largest of the fitness values of the solutions to be crossed, 0 < 1 , 2 < 1, and 2 is the default crossover probability. In order to make the optimal individual have higher crossover probability, is refined by A threshold related with the current reproduction generation is where is the maximum value of reproduction generations, is the current value of reproduction generations, and /20 is an adaptive coefficient. We also define a variable , which represents the holding time (reproduction generation) of the optimal individual of population. The last adaptive step for is (b) Mutation. Mutation introduces random binary changes in a chromosome, which helps escape from local minima's trap and maintains diversity in the population. For binary representation, a simple mutation can consist in inverting the value of each gene with a small probability. In this paper, an improved mechanism of mutation is introduced. Move the actual coordinates of randomly selected individuals representing a real gene; displacement amplitude is based on the individual fitness of scale. The larger the fitness of the individual chromosome is, the smaller the displacement amplitude would be. The probability of mutation is adjusted by using the following equation: where min is the minimum value of the chromosome fitness and 1 is mutation probability constant. is only related to the displacement amplitude; the relationship is based on the following expression: where denotes the displacement amplitude, is random, and represent displacement length:

Simulation Results
The objective of this work is to have an optimal deployment for PIR-based indoor localization. We consider in the simulation 12 m × 7.2 m area. The thickness of wall is 0.2 m and the door of all the space, such as the kitchen and bathroom, is 0.2 × 1.0 m. By calculating exact size of various places, all the possible coverage area for PIR sensors is 75.12 m 2 . The PIR sensing area in this setup is a shape of circle on the floor with a radius of 1 m. Table 1 summarizes the parameters in the implementation of GA. These parameters were obtained empirically after several experiences. In order to analyze the performance of our method, several simulation experiments were conducted for the performance evaluation. Hence, we compared the simulation running time and fitness function value when the deployed PIR sensors' number is different for the special indoor environment first. Then we investigated how the accessible heatmap rank affects the PIR deployment in case of a given scenario. Next, we took a closer look at how to keep the tradeoff between the coverage and overlap of the PIR sensing area. And finally, we compared the performance of three deployment methods.
International Journal of Distributed Sensor Networks 7  Table 2. In case of a given indoor environment, when the PIR sensors' number is lower than 7, the increase in the number of deployed PIR sensors will not affect the deployment of PIR sensors. However, the number of PIR sensors is larger than 7 and the deployment of PIR sensor will vary with the PIR sensor numbers. In our lab, the PIR sensors' number needs to be determined according to the fitness function. In Figure 4, the fitness value changes for different population size and PIR sensors' number. As is shown, a specific plot represents the fitness versus time under the fixed PIR sensor number. There are three sections in one curve. Section I shows the reproduction in region A, Section II shows the reproduction in region B, and Section III represents the results of mutation with region A and region B. The fitness increases as the PIR sensor number increases.

Effect of Rank of the Accessible Heatmap.
The second experiment was performed to understand the effect of the accessible heatmap score rank. The heat score is used to equally divide the original heat zones based on the different degrees of heat. With the heat range being fixed, the corresponding heat division would be accurate when increases. This can effectively eliminate the multiple priority layouts. Because our rule is that only the low rate zones' overlap should be punished, the relatively low rate heat range's decrease will lead to the increase of the PIR overlap range. Therefore, the experiment was done to get an appropriate . The number of PIR sensors is set as 10 in the following experiments. denotes the rank of "heat" score of the th grid point, related to the accessible frequency of the areas. According to the "heat" score range of the accessible map, a set of values { 1 , . . . , } is defined. is the scale size of the "heat" score range. The value of increases as the "heat" score of the grid point is larger. Figure 5(a) shows the accessible map at rank = 4, and Figure 5(b) describes the corresponding PIR sensor deployment. Figure 5 directly presents the features of the PIR layout when is set as different numbers. When more accurate heat stratification is needed to eliminate the multiple priority, one method is to increase the rank . Figures 5(c) and 5(e) show that the heat stratification is growing accurate with the increase of the rank . However, increasing the rank will make the PIR layout tend to overlap. Compared to Figures 5(b) and 5(d), the appropriate overlap theory can enhance the localization accuracy. But this increasing to a certain degree, serious overlap would occur, shown as in Figure 5(f). At this point, it is the same as accuracy. After comparison, the heatmap rank degree is set as 6.

PIR Coverage and Overlap Rate by Different PIR Number.
The third experiment examined the effect of the PIR sensors' number against the sensing coverage and overlap. Three parameters are defined to evaluate the effect of PIR sensor number on the sensor coverage. They are listed as follows: (a) Maximum coverage ratio cov max is the ratio of area that can be covered by all PIRs without overlap Covered over the entire sensing field Total : (b) Actual coverage rate act , which is defined as sum of PIRs sensing areas based on the solution deployment sp over the deployment area of the specific space : (c) Overlap rate , which is defined as the sum of PIRs overlap areas over sum of PIRs sensing areas based on the solution deployment sp : The results can be seen in Table 3. The value is not too large when the PIRs number is less than 8. The results show that the rule of increasing PIR coverage has more priority; the proposed algorithm improves the coverage of PIRs to 8 International Journal of Distributed Sensor Networks  enhance indoor localization. There is no change in overlap rate when the PIRs number is 8 to 10. However, if the number of PIRs is greater than 10, the will increase. So the optimal number of PIRs for our simulation experiment is 10. The data in Table 3 indicate that the overlap rate is small and there occurs no overrated overlap if PIRs number is lower than 8. This shows that the overlap rate tends to be low if the PIRs number is small, which goes in line with the coverage priority principle. That is, the coverage needs to be more if there are fewer PIRs. The overlap rate and overrated overlap remain unchangeable when the PIRs number is 8, 9,     accuracy has not much increased. Hence, we would believe the best PIRs number which is 10 would be the best layout.

Performance by Three Deployment Methods.
In the last experiment, changes in the fitness by GA, greedy algorithm, and manual random deployment were observed. The performance curves by three various PIR deployment algorithms are presented in Figure 6. The green curve is with the GA method and the red and blue curves are represented by greedy algorithm and random deployment, respectively. Our purpose is to find a common way to solve the PIR sensor layout problem from simple to complex. When people do not know how to make PIR sensor layout, the simplest way is to put them in an optional space by random deployment. Then, the possible method is to place the sensor according to the fitness value in order which is named greedy algorithm. After careful consideration of the previous method, it can be found that all the sensors are not placed at the same time, so it is likely to lead to a local optimal state. GA is a parallel algorithm which can solve this problem easily. Although the performance between GA and greedy algorithm is similar at the beginning, the gap is increasing with the increase of the number of PIR sensors. In fact, the gap has a greater impact on the accuracy of the location experiment when the sensor layout is determined. The results show the PIR sensors layout is not ideal by manual random deployment and also not stable. As the PIR sensors number increases, the performance by our proposed method is better than the other two.

Conclusion
The main contribution of this paper was to optimize the coverage in sensor networks considering area accessible frequency. The GA we proposed to solve the coverage problem defined in this study stands out with its novel fitness function, which is quickly calculable and based on area priority. Additionally, the proposed optimizations are novel approaches that we introduced in this study that allow for faster convergence of the solutions. The actual coverage rate is 39.03%, and overlap rate is 7.14% when the number of PIR sensors is 10. The running time of our method for PIR sensor layout is greater than 10 minutes. It will increase according to the number of PIR sensors. In the future, we tried to obtain the PIR sensors layout by the multiobject function and some considerations will be placed on the efficacy of the algorithm.