## 3 Methodology
### A Centralized Routing Protocol for Lifetime and Energy Optimization Using GA and LSPI  
After the network initialization, the sink generates possible distance-based MSTs using the GA-based MSTs. The generated MSTs are used as the routing tables (RTs) by the CRPLEOGALSPI. The optimization problem addressed by the CRPLEOGALSPI is to maximize the network lifetime while minimizing the network energy consumption in the WSNs. The optimization problem is formulated as a bi-objective mixed integer programming defining the objective function and the set of constraints. Figure 3: Crossover between two MSTs T1 and T2. Figure 2: MST Mutation. The optimization problem is to find the RT such that:  
\[\max_{v\in V}\biggl{\{}ESRE_{v}\biggr{\}}+\min_{v,\mu\in V}\biggl{\{} \sum_{u=0}^{|V|}\sum_{v=0}^{|V|}e_{u,v}EC_{u,v}\biggr{\}}subjectto \tag{22a}\] \[\sum_{u=0,\mu\
eq v}^{|V|}e_{u,v}=1\] (22b) \[\sum_{v=0,\mu\
eq v}^{|V|}e_{u,v}=1\] (22c) \[d_{u,v}\leq R_{max}\] (22d) \[e_{u,v}\in\{0,1\} \tag{22e}\]  
Equation (22a) is the objective function and Equations (22b)-(22e) are the constraints. The variable \(ESRV_{v}\) is the estimated sensor node residual energy of the \(v\)th sensor node. \(e_{u,v}\) is the connection index when the \(u\)th sensor node is connected to the \(v\)th sensor node. \(E_{u,v}\) is the energy consumption when the \(u\)th sensor node communicates with the \(v\)th sensor node. \(d_{u,v}\) is the link distance between the \(u\)th sensor node and the \(v\)th sensor node. \(R_{max}\) is the network's maximum transmission radius. The first term of the objective function in Equation (22a) is used to maximize the network lifetime, while the second term is used to minimize the network energy consumption. The constraints in Equation (22b) and (22c) ensure that the routing path is a tree. The constraint in Equation (22d) enables transmission between two connected sensor nodes whose link distance is less than or equal to the maximum network transmission radius. Therefore, the CRPLEOGALSPI tries to find the RT that maximizes the network lifetime while minimizing the network energy consumption using LSPI. The network lifetime considered in the design of the CRPLEOGALSPI is the time for the network graph to be disconnected; that is, the time taken for an alive sensor node not to find a path to the sink for data transmission. The CRPLEOGALSPI is deployed at the sink. The solving process of the objective function subject to the constraints is given in the design of the proposed protocol using LSPI and is provided in the sequel. The state space and action space of the agent are the MSTs generated by the GA-based MSTs. For a current MST, \(s\), being used by the sink in receiving data from the sensor nodes, the action of the agent is to choose another MST, \(a\), that maximizes the network lifetime while minimizing the network energy consumption. The next state of the agent, \(\hat{s}\) is the same as the choosing action in the current learning episode, that is, \(P(\hat{s}|s,a)=1\). The features considered in designing the basic functions of the CRPLEOGALSPI for the state-action pair are the maximum energy consumption of the sensor nodes, \(EC_{max}(s,a)\) and the sum of the energy consumption of the sensor nodes, \(EC_{sum}(s,a)\) when using \(a\) to receive data packets by the sink. The first basic function is used to model the maximization of the network lifetime, while the second basic function is used to model the minimization of the network energy consumption. The set of the basic functions for the state-action pair \((s,a)\) is therefore given as \(\varphi(s,a)=\biggl{\{}EC_{max}(s,a),EC_{sum}(s,a)\biggr{\}}\).