## 2 Methodology
### An Optimal Energy Resources Allocation Method Based on Clustering Optimization
#### 2.2.1 Clustering and Cluster Head Initialization Based on Improved K-Medoids
Clustering formation and optimization process is a non-linear multi-objective optimization problem [21]. Therefore, in the actual optimization process, heuristic optimization algorithm is often used to solve multi-objective optimization problems. In this paper, genetic algorithm [22] is used to solve the multi-objective optimization model. The optimization algorithm based on genetic algorithm is a process of getting the optimal chromosome through chromosome selection, crossover, mutation, and other processes based on the initial population. In this paper, the population size (the number of chromosomes) is \(m\), each chromosome consists of \(N\) genes. The position and content of each gene respectively represent the position of the sensor and the corresponding cluster number to be assigned. As shown Figure 5, the sensors of the railway status monitoring system are all assigned with fixed numbers [1, 2,..., \(N\)], and the cluster numbers [1, 2,..., \(k\)] indicate the corresponding cluster serial numbers of each sensor. Genetic algorithm needs many iterations to get the optimal result. In order to improve the optimization speed of genetic algorithm, K-medoids algorithm is used to initialize clustering, and an initial chromosome close to the optimal result is generated in this paper. Then, on the basis of clustering chromosomes, the remaining \(m-1\) chromosomes are generated by the way of frameshift mutation. All \(m\) chromosomes together constitute the initial parent population \(P\). The specific steps for solving multi-objective optimization of clustering by genetic algorithm (Algorithm 2) are defined as follows:

### Partial Coverage Model of Wireless Sensor Network Based on Polynomial Time Algorithm

The basic idea of wireless sensor network coverage model is to give the number of targets \(T\), use the number of limited nodes \(N\), limited energy \(E\), and improve the lifetime of wireless sensor network on the premise of meeting the coverage requirements. In order to ensure that any position in the monitoring area is covered by at least one sensor node at any time, the full coverage model is often adopted. In wireless sensor network coverage model, \(S=\{s_{1},\,s_{2},\ldots,s_{N}\}\) represents sensor nodes set, \(R=\{r_{1},\,r_{2},\ldots,r_{T}\}\) represents coverage targets set. The sensing range of wireless sensor nodes \(s_{k}\) is a circle with sensing radius as its radius. An example of node coverage of wireless sensor network is shown in \[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]2

As shown in Figure 6, target \(r_{1},r_{2},r_{3},r_{4}\) receive wireless sensor node \(s_{1},s_{2},s_{3}\) monitoring, respectively. The relationship between sensor node and target is not one to one; it results in the imbalance between energy consumption and residual energy of sensor nodes. Considering the balance of energy consumption of wireless sensor network, the energy of a certain area \(E_{k}\) is defined as follows:

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]3

where \(E_{k_{i}}\) represents the residual energy of the \(k\)-th cluster, \(N_{k}\) represents number of nodes in the \(k\)-th cluster. \[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]4 Chromosome mutation process. However, the full coverage algorithm would produce a large number of redundant nodes and generally require nodes to have accurate location information, which generates a great challenge for constructing a low-cost and high-density wireless sensor network. In reality, full coverage sometimes is not necessary. Partial coverage algorithm means that the deployed wireless sensor network only covers part of the monitoring area at a certain time. Under the premise of meeting the required coverage, in each round, some nodes are selected to work, and the rest nodes are in the sleep state.