# A Novel RPL Algorithm Based on Chaotic Genetic Algorithm
## 3 RPL-Cga
### Optimizing Weighting Factors of Routing Metrics  
Supposing that there are \(n\) nodes in the candidate parent set, and RPL-CGA considers \(m=5\) routing metrics (QL, EED, RER, HC, and ETX). Let the value of the \(j\)-th (\(j=1,2,\cdots,m\)) metric of the \(i\)-th candidate parent (\(i=1,2,\cdots,n\)) be expressed as \(x_{ij}\) (\(i=1,2,\cdots,n;\ j=1,2,\cdots,m\)). Then, the sample set of each metric value at each candidate parent is \(\{x_{ij}|i=1,2,\cdots,n;j=1,2,\cdots,m\}\). It can be written as a matrix named as initial judgment matrix \(\mathbf{X}\). \[\mathbf{X}=\left[ \begin{array}{ccccc}x_{11}&x_{12}&x_{13}&\cdots&x_{1m}\\ x_{21}&x_{22}&x_{23}&\cdots&x_{2m}\\ \cdots&\cdots&\cdots&\cdots&\cdots\\ x_{n1}&x_{n2}&x_{n3}&\cdots&x_{mm}\end{array} \right] \tag{8}\]  
After that, the weighting factor of the \(j\)-th metric is set as \(a_{j}\) (\(j=1,2,\cdots,m\)), and \(F(i)\) (\(i=1,2,\cdots,n\)), and the comprehensive evaluate function of candidate parents can be obtained by weighted summation of metric weighting factors and metric values \(x_{ij}\), as shown in Equation (9). \[F(i)=\sum\limits_{j=1}^{m}a_{j}x_{ij},\ (i=1,2,\cdots,n;j=1,2,\cdots,m) \tag{9}\]  
Therefore, through the appropriate weighting factor allocation of each metric (\(\mathbf{a}=(a_{1},a_{2},\cdots,a_{m})\)), all the candidate parents comprehensive evaluate values \(F(i)\) (\(i=1,2,\cdots,n\)) can be obtained. Then node \(i\) with a minimum value of \(F(i)\) will be selected as the preferred parent. Here, \(\mathbf{a}=(a_{1},a_{2},\cdots,a_{m})\), and the unit vector and weighting factor of each metric should meet the following constraint conditions:  
\[s.t.\left\{ \begin{array}{l}0\leq a_{j}\leq 1\\ \sum\limits_{j=1}^{m}a_{j}=1\end{array} \right. \tag{10}\]  
It can be seen that the selection of the preferred parent becomes a problem of finding the optimal solution under constraint conditions. That is, when the initial decision matrix is obtained, the weighting factor (\(a_{j}\)) of every routing metric can be obtained through a multi-attribute optimization algorithm. In this way the comprehensive evaluating function \(F(i)\) of every candidate parent is obtained. Finally, the candidate parent with the lowest \(F(i)\) can be chosen as the preferred parent. For this purpose, this paper proposes the use of a chaotic genetic algorithm (RPL-CGA) to determine the weighting factor of each metric in the composition metric. Then, the preferred parents can be selected through comprehensively evaluating nodes in candidate parent set. In RPL-CGA, the initial population genes are produced through a chaotic system, and every population individual containing \(m\) genes is a kind of possible metric weighting factors distribution scheme (\(\mathbf{a}=(a_{1},\ a_{2},\cdots,\ a_{m})\)). Then, the populations are improved via superior individual choice, cross, mutation, chaos perturbation, and other steps. When certain conditions are met, the algorithm ends. At this point, the population individual with the maximum fitness function value is the final weighting factors allocation scheme of routing metrics. The concrete realization processes of RPL-CGA are as follows. Step 1: initialization  
Determining relevant parameters used in RPL-CGA, such as population size \(w\), cross probability \(P_{c}\), mutation probability \(P_{m}\), the maximum number of iteration \(k\), etc. Step 2: constructing fitness function  
A fitness function can be used to assess the quality of population individuals. A better quality of population individuals shows greater performance and the greater probability of these individuals existing among the next generation. For the sake of ensuring the superiority of individuals, the selection of individuals is based on fitness function values. That is, individuals with greater fitness function values have a greater probability of existing among the next generation. In RPL-CGA, the selection of preferred parents is based on the comprehensive evaluation function \(F(i)\).