Research Article

Firefly Optimization-Based Cooperative Localization Algorithm for Intelligent IoT

Algorithm 2

Cooperative localization algorithm based on firefly optimization. Specific flow of the cooperative localization algorithm.
Input:
the measured distance from the k-th anchor node to the i-th unknown node,
the measured distance from the i-th unknown node to the j-th unknown node
Output:
the estimated position of the i-th unknown node
(1)i = 1;
(2)while all the unknown nodes’ positions have not been calculated do
(3)calculate the initial position of the i-th unknown node using the firefly algorithm;
(4)i = i + 1;
(5)end
(6)randomly initialize the fireflies;
(7)while maximum iteration is not reached do
(8)calculate the objective value of the firefly using formula (5)
(9)calculate the relative brightness of fireflies using formula (6);
(10)calculate the attraction of fireflies using formula (7);
(11)update the position;
(12)end