In sample PSO algorithms mainly focus on minimizing the objective function.But in my case i need to maximize my objective function.What are the changes to be done in existing PSO algorithm inorder to maximize the objective function.
Dear Prabha, this is just a conditional parameter.
At the moment you update the best visited position, you must submit it to the objective function.
To minimize, we just use an if condition to verify if the new score is < than the older one. To maximize, I think you must verifiy if the new score is > than the older one.
It appears that the original question was about the right transformation such that the methodology would recognize that we do not want to minimize, but to maximize, the objective. Indeed, the most natural way is simply to add a minus sign to the objective function.
The trick to use 1/f(x) may be really bad, since you upset every possible good property of the original objective function f; in any case it is necessary to check whether the transformed objective "behaves" well.
Mohamed's second trick can back-fire also, as it leads to a permanent change to the objective.
There are numerous method to change according to desired problem.
Max(f) = - min(-f)
Beside, you may understand the basic and step by step procedure of PSO algorithm in a very simple manner through the following video. See and wait for my next update.
If you have the source code of the algorithm (or if you code it by yourself), you can just change the comparison test... from < to > in the update best steps (personal, neighborhood and global bests).
For maximizing a function, after evaluating the objective function you have to set the particle with HIGHEST fitness value as gbest. Similarly, the update conditions will be opposite to that of minimization problems.