PSO optmizer implementation