1: Procedure  OPTIMIZERESOURCEUTILIZATION( : 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:  end for
11:  if not null then
12:    discoverLBAs()
13:    findSuitableHost( , )
14:   if not null then                Agent migration
15:     .clone( )
16:     getSensorIDs( )
17:     .assignSensors( , )
18:    kill( )
19:   else                     Agent priority reduction
20:    increasePeriodicity( )
21:   end if
22:  end if
23: End procedure
Algorithm 4: Algorithm to reduce CPU and memory usage by migrating agent across physical machines and task periodicity adaptation. : maximum task load, : upper threshold task load, : agent task load, : overload agent identifier, : agent clone identifier, and : list with sensor identifiers.