## 3 Spawn Multi-Mobile Agent Itinerary Planning (SMIP) Approach
### SMA Itinerary Energy Calculation  
A WSN is defined as a complete graph \(G=(V,E)\)[11], consisting of a set of \(N\) vertices, \(\left|V\right|=N\), where each vertex \(i\), \((i=0,1,2,\ldots,N-1)\) in \(V\) corresponds to a sensor node (SN), \(S_{i}\)\((i=0,1,2,\ldots,N-1)\), and each edge \(L(i,j)\) in \(E\) corresponds to a wireless communication link between each pair of sensor nodes \(SN_{i}\) and \(SN_{j}\). The node \(S_{0}\) represents the sink node, which dispatches  
Figure 3: An example of data gathering based on: (**a**) greatest information in the greater memory-based MIP (GIGM-MIP); (**b**) spawn multi-mobile agent itinerary planning (SMIP) approach algorithm.  
and receives the MAs. Furthermore, there are \(M\) source nodes included in a specific subset \(K^{\prime}\), where \(K^{\prime}\in S\).  
The wireless communication link \(L(i,j)\) is associated with a link cost \(C(i,j),i,j\in(0,1,2,\ldots,\)\(N-1)\)--a function of the power loss to transfer the packet from \(Si\) to \(Sj\). Given the cost matrix \(C=C(i,j)||L(i,j)\in E\), in MIP, the MA routing problem is to find a set of \(t\) near-optimal itineraries, \(I=I_{1},I_{2},\ldots,I_{t}\) so that the overall cost of all the itineraries in \(I\) is reduced. Each particular \(I\) will cover a group of sensor nodes \(K^{\prime}\) which is a subset of \(S\). In order to avoid the interference, each two itineraries should share no common source nodes. The process of the LCF algorithm is to assign the source nodes to an MA'itinerary one by one depending on the shortest distance to the current location of the MA. Then, this process is repeated again for the second MA'itinerary and so on until all the remaining source nodes are assigned to all MAs' itineraries. In this case, each MA'itinerary will have a different set of source nodes from other MA'itineraries. Each MA'itinerary has a migration energy cost. The total energy cost of all the itineraries can be written as:  
\[Ctotal=\sum_{t=1}^{|I|}IC^{t} \tag{5}\]  
where \(IC^{t}\) is the energy cost of itinerary \(I^{t}\) covered by the MA, and \(IC^{t}\) can be simplified to:  
\[IC^{t}=\sum_{j=1}^{|I^{t}|}(jdf+pc)c_{i,j} \tag{6}\]  
\(|I^{t}|\) represents the number of visited nodes in the itinerary \(I^{t}\) by the MA, \(j\) is the visited sensor node, \(jdf\) means the size of data collected by the MA at sensor node \(j\) after aggregated by a ratio \(f\), \(pc\) is the MA's initial size (processing code plus MA packet header), and \(c_{i,j}\) is the energy consumption of the MA to migrate from sensor node \(i\) to sensor node \(j\). Note that \(j\) could act as source node (has data to be collected by the MA) or intermediate node (only hop).  
In order to calculate the total energy cost in our proposed SMIP approach, the energy cost of both types of itineraries (main MA itinerary and SMA itinerary) has to be taken into account. Therefore, the total energy cost of SMIP approach can be calculated as follows:  
\[C_{total}SMIP=\sum_{t=1}^{|I|}IC^{t}+\sum_{h=1}^{|I_{SMA}|}I_{SMA}C^{h} \tag{7}\]  
where \(I_{SMA}C^{h}\) is the energy cost of itinerary \(I_{SMA}^{h}\) covered by the SMA. So, \(I_{SMA}C^{h}\) can be simplified to:  
\[I_{SMA}C^{h}=\sum_{m=1}^{|I^{h}|}(m+pc_{SMA})c_{m,j}^{SMA} \tag{8}\]  
where \(|I^{h}|\) refers to the number of visited nodes in the itinerary \(I^{h}\) by the SMA, \(m\) is the visited sensor node, \(pc_{SMA}\) is the SMA's initial size (processing code plus SMA packet header), and \(c_{m,j}^{SMA}\) is the energy consumption of the SMA to migrate from sensor node \(m\) to sensor node \(j\). It should be noted that \(m\) in Equation (8) acts only as an intermediate node, which means there is no data to be collected along the SMA itinerary.