Rank: 112762 based on 0 downloads (last 30 days) and 0 file submitted
photo

Oliver

E-mail
Company/University
BYU

Personal Profile:
Professional Interests:
Materials Science

 

Watch this Author's files

 

Comments and Ratings by Oliver
Updated File Comments Rating
22 Oct 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Sam,

Thanks for your submission, it works wonderfully. And thank you for sticking to familiar syntax for those of us who have been using the optimization toolbox, this really helps with the learning curve.

I saw some comments about taking advantage of parallel processing, but it didn't look like anyone has done anything about it thus far. When I profiled pso using my objective function the big place that things got bogged down was obviously in the many objective function evaluations. As such I changed the code a little bit to evaluate all of the objective function calls in parallel. I changed the following lines from this:

for i = setdiff(1:n,find(state.OutOfBounds))
state.Score(i) = fitnessfcn(state.Population(i,:)) ;
end % for i

to this:

tempstatepop = state.Population;
itinerary = setdiff(1:n,find(state.OutOfBounds));
temp = zeros(length(itinerary),1);
parfor i = 1:length(itinerary)
temp(i) = fitnessfcn(tempstatepop(itinerary(i),:)) ;
end % for i
state.Score(itinerary) = temp;

This is probably a crude way of doing it, but even so I saw a speed up of just under 3 times. Perhaps something similar will be helpful in a future build. Thanks again.

-Oliver

Contact us