1: Procedure  OPTIMIZETASKTHROUGHPUT( : SET OF MOBILE AGENTS)
2:   0    
3:   null
4:  for all do                Find max. loaded agent
5:    getTaskLoad( )
6:   if then
7:    
8:    
9:   end if
10:  enf for
11:  if not null then                  Split task load
12:    getSensorIDs( )
13:    split( , 2)
14:    length( )
15:   if then
16:     numberOfClones( )
17:     length( )
18:    if then           Local cloning
19:      clone( )
20:     reAssignSensors( , )
21:     reAssignSensors( , )
22:    else                     Remote cloning
23:      discoverLBAs()
24:      findSuitableHost( , )
25:     if not null then
26:       .clone( )   
27:       .assignSensors( , )
28:      reAssignSensors( , )
29:     end if
30:    end if
31:   end if
32:  end if
33: end procedure
Algorithm 2: Algorithm to optimize the task throughput by assigning subtasks to clones. : maximum task load, : upper threshold task load, : agent task load, : mobile agent instances threshold, : overload agent identifier, : agent clone identifier, : list with sensor identifiers, and : agent instances threshold.