Research Article

Fuzzy Dynamic Parameter Adaptation in ACO and PSO for Designing Fuzzy Controllers: The Cases of Water Level and Temperature Control

Algorithm 1

PSO algorithm.
FOR each particle i
FOR each dimension d
Initialize position xid randomly
Initialize velocity vid randomly
END FOR
END FOR
Iteration k=1
DO
FOR each particle i
Calculate fitness value
IF the fitness value is better than p_ in history
Assign current fitness value as the p_
END IF
IF the fitness value is better than g_ in history
Assign current fitness value as the g_
END IF
END FOR
FOR each particle i
FOR each dimension d
Calculate w, c1 and c2 with the fuzzy inference system
Calculate velocity using the equation
vid (k+1) = w vid (k) + c1 Rand1 (pid - xid) + c2 Rand2 ( - xid)
Update particle position using the equation
xid (k+1) = xid (k) + vid (k+1)
END FOR
END FOR
k = k + 1
WHILE Maximum iterations or mínimum error criteria are not attained