Thus, assuming the MA follows an itinerary determined based on the information gain, the migration from node to node is constantly increasing the accuracy of the integrated result. Therefore, the MA can terminate its migration and returns the results when the accuracy of the integrated result satisfies a given threshold. Figure 1: Data gathering based on: (**a**) Client-Server. (**b**) mobile agent (MA). This advantage of MA decreases both network bandwidth and computation time by avoiding visiting unnecessary nodes. * _Reliability:_ The MA can be dispatched when the network connection is active and it returns the results when the network connection is re-established. Consequently, the MA's performance is not affected much by the reliability of the network. In WSNs based on MA, the MA design can be broken down into four components [13]:
* Architecture
* Itinerary planning
* Middleware system design
* Agent cooperation  
Among the MA design components, the itinerary planning has a direct impact on the energy consumption. The itinerary planning of the MA is the order determination of the source nodes to be visited during the MA migration. Finding the optimal itinerary of the MA has been identified as an NP-hard problem [6]. Along this line, itinerary planning algorithms have been developed to determine sub-optimal MA itinerary. The itinerary planning algorithms can be classified into single itinerary planning (SIP) and multi itinerary planning (MIP) [14]. In SIP, only a single MA is dispatched from the sink to visit the source nodes. The SIP algorithms [4; 5; 6; 15] proposed earlier only performed well in small- or medium-scale sensor networks. However, in a large-scale networks, SIP incurs the following drawbacks [14]:  
* Long delays because of migrating to hundreds of source nodes. * An increase in the MA's packet size due to the aggregation of data from a huge number of visited source nodes. * Low reliability when the MA accumulates a huge amount of data. * The probability of losing the MA's packet increases when a single MA visits many source nodes. In order to overcome the drawbacks of SIP, multi itinerary planning algorithms [16; 17; 18] were proposed. In MIP, several MAs are distributed to the network. The MAs work concurrently to visit groups (partitions) of source nodes. Each MA is assigned to one partition within a shorter itinerary, where it migrates to a subset of source nodes (within a partition) to perform the data aggregation task. The dispatched MA carries its processing code (e.g., aggregation code) from the sink to the assigned partition to collect the data from the source nodes. On completing its task, it returns to the sink with the accumulated data. The size of the accumulated data by the MA varies from one partition to another, which depends on the number of source nodes within each partition. This process enables a reduction in the MA packet size, which further leads to a decrease in the energy consumed as compared to the SIP algorithms. Moreover, due to the distribution of aggregation tasks among multi MAs, the task duration is minimized (lower delay). Although the MIP did overcome the weaknesses of the SIP algorithms, its design is complicated due to the introduction of several challenging issues [11], which include:  
* Determining the optimal number of MAs. * Partitioning the source nodes into subsets of groups and assigning each MA to a specific group. * Finding the optimal itinerary of each MA. A greatest information in the greater memory-based MIP (GIGM-MIP) approach was proposed in [19]. In the GIGM-MIP approach, each partition may have more than one MA. The data size of the source nodes in each partition will determine how many MAs will be dispatched to that partition. Although this solution has balanced the accumulated data among MAs, employing more than one MA in one partition results in an increase in the number of MA migration hops due to the increased number of itineraries in each partition.