Clear Filters
Clear Filters

Tolerance criteria for cost function obtained with PSO

5 views (last 30 days)
Hi,
I have applied PSO for minimization of RMS value that is my cost function. I have used 150 iterations. How can I set up a tolerance criteria (e.g. 10^-12) for the cost function? So I want to run PSO until I get the cost function close to 10^-12. I call the PSO function within the script and the function outputs the best position, best cost, and cost convergence for 150 iterations. Should I set the tolerance criteria inside the script like a for loop or something else? Any advice would be very helfpul. Thanks.

Answers (1)

Walter Roberson
Walter Roberson on 30 Nov 2016
You can set FunctionTolerance in relative terms. You would want to set MaxIterations high.
  1 Comment
EB
EB on 30 Nov 2016
Can you give some more explanation. I went through the link you have provided but I can not find the solution to my problem.
I am not calling built in Matlab particleswarm solver for my optimization problem. I've built the PSO for my problem in a separate function and I call the function PSO_EBW_SD within a script. The function PSO_EBW_SD outputs a structure array out. This array contains two fields: best cost and best solution.
The PSO_EBW_SD function is set up that it's terminates when max number of iterations is achieved.
When I am within the script and call the PSO_EBW_SD I get one value for the best cost and best sol. If I call the PSO_EBW_SD again it will give me other value for the best cost and best sol. IS there a way how I can stop this? I thought that set up of a tolerance criteria for the objective function e.g. Tol = 1e-6it will help. So what I am trying to achieve is to run the PSO_EBW_SD as many times I need in order to get the best cost equal or less than Tol.
I don't know how to set up this criteria. I've read some example on output function http://uk.mathworks.com/help/optim/ug/output-functions.html Should I have this output function as well even though I am not using the built in solver particleswarm.
Suggestions are more than welcome. Thanks!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!