# Energy Optimization in Cluster-Based Routing Protocols for Large-Area Wireless Sensor Networks
## 4 Optimization of \((k,R)\)  
Our goal is to find the optimized \(k_{opt}\) (\(0<k_{opt}<N\)) and \(R_{opt}\) (\(L<R_{opt}<2L\)) to minimize \(E(k,R)\) as in:  
\[(k_{opt},R_{opt})=\arg\min_{(k,R)}E(k,R). \tag{25}\]  
We note that \(k_{opt}\) can be calculated as a real number, which can be readily applied to the LEACH algorithm by using rounding off form \([N/k]\) for the place of \(N/k\) in the cluster-selection probability (Equation (3)).  
Although \(E(k,R)\) is high-order differentiable, getting gradients or Hessian matrix is expensive and complicated. Since \(E(k,R)\) is observed to have convex-downward shape, as shown by the simulation presented below, we choose Nelder-Mead (N-M) Simplex algorithm [26; 27], as a derivative-free optimization method. We suggest constructing the initial simplex as the following three vertices, \(\mathbf{v}_{1}\), \(\mathbf{v}_{2}\), and \(\mathbf{v}_{3}\):  
\[\mathbf{v}_{1}= (k_{1},R_{1})=(5,\frac{3L}{2}),\] \[\mathbf{v}_{2}= (k_{2},R_{2})=(5+\Delta_{k},\frac{3L}{2}+\Delta_{R}),\] \[\mathbf{v}_{3}= (k_{3},R_{3})=(5+\Delta_{k},\frac{3L}{2}-\Delta_{R}),\]  
where \(\Delta_{k}\) and \(\Delta_{R}\) are 5% value of \(k_{1}\) and \(R_{1}\), respectively. In the first simplex \(\mathbf{v}_{1}\), \(k\) is chosen to be 5 and \(R\) is taken as the mid-point of interval \([L,2L]\). Large-area sensor networks with large number of sensor nodes often show the optimum values of \(k_{opt}\), which are greater than \(k=5\) by conventional rule of thumb. Therefore, we suggest that both the second simplex \(\mathbf{v}_{2}\) and the third, \(\mathbf{v}_{3}\), have \(k=5+\Delta_{k}\), instead of using conventional initialization with \(k=5+\Delta_{k}\) for \(\mathbf{v}_{2}\) and, \(k=5-\Delta_{k}\) for \(\mathbf{v}_{3}\).  
The N-M optimization algorithm starts with the three vertices \(\mathbf{v}_{1}\), \(\mathbf{v}_{2}\), and \(\mathbf{v}_{3}\). The function \(E(k,R)\) takes on values \(E(\mathbf{v}_{1})\), \(E(\mathbf{v}_{2})\), and \(E(\mathbf{v}_{3})\). The function values are to be compared to determine the best vertex, second best vertex, and the worst vertex. For N-M simplex transformations, we have used the standard values, 1, 1/2, 1, and 1/2 for the reflection, expansion, contraction, and shrink transformation, respectively. According to the N-M implementation in [27], we iteratively continue the ordering, centroid, and transformation steps of N-M algorithm with given termination tests to obtain the optimization value of \(\mathbf{v}_{opt}=(k_{opt},R_{opt})\).  
It is noted that the computational procedure for our proposed optimization described in this paper is not carried out by the sensor nodes, but is carried out at the base station (BS) and/or at the management center, which are assumed to have enough computational capabilities being supplied with sufficient power. The optimized parameters \((k_{opt},R_{opt})\) calculated at the management center can be implemented as a design parameter during the firmware installation for sensor nodes. The optimized parameters calculated at the BS can be broadcast to the sensor nodes deployed in the field through the wireless channel.