Research Article

Jammer Localization in Multihop Wireless Networks Based on Gravitational Search

Algorithm 2

GSA-based localization algorithm.
Input: the state and position of MHWN nodes
Output: the estimated jammer’s position
(1) Initialize number of iterations , number of particles
, acceleration, velocity and position of the particle,
gravity coefficient and time constant .;
(2) for    do
(3) Random select particles in the jammed area;
(4) Calculate the fitness function for each particle;
(5) Save the best value at this iteration and update the
global best value;
(6) Calculate the mass and normalized mass of the
particles;
(7) Calculate the resultant force in each dimension for
all the particles;
(8) Update the gravity coefficient and acceleration,
velocity, position of the particle.
(9) end for