Dear Carlo, Thank you, Helpful as always. The reason why am using the loop functions, is because i need at every step/iteration/loop to reevaluate the global maxima and the local maxima, which are the potentiometers to my PSO algorithm, also the cost function is the light intensity that is being cal...