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

Amaraporn

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Amaraporn View all
Updated File Comments Rating
02 Jun 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Sam, Many thanks for your kindly reply. When i used the default with test funcion of 12 inputs. The 12 output never reached the known global min. Then I tuned up all possible parameters in your toolbox and found the best parameter set comprising
CognitiveAttraction=1.5
SocialAttraction parameters =1.5
Generation = 300
popsize= 50

which made the 11 out of 12 outputs meet the theoritical min. Till now I could not find any pso parameter set that can bring the output converge to the same point of every runs which is the general expectation for global min. Somehow making boundary more stricly may be helpful, so i'm trying it at the moment.

23 May 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Dear Sam

Just one quick question about pso algorithm parameters used in your toolbox. I have tried to tune
problem.options.Generations eg. 10000
problem.options.CognitiveAttraction eg. 2
problem.options.SocialAttraction eg. 2
problem.options.StallGenLimit eg. 8000
problem.options.PopulationSize eg. 40
and initial inertia eg. 1

but global min could not been found for my objective function of 12 parameters. I'm seeking other important parameters and wondering if you got these following parameters somewhere in the algorithm. "inertia reduction parameter", "bound and velocity fraction","velocity reduction parameter"

06 May 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Sam

Many thanks for all of your feedbacks :) Now I can use your toolbox with actual function though spent almost a whole day for a clean termination. I'm not a computing guy so a bit wondering about its time consuming. Is it sounds resonable for the obj function which fits the 12 parameter dynamic model to the data of (5000 frames) time history of experimental dynamic motion? Anyway this is a good toolbox for everyone including students from out of field, I confirm :)

04 May 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Dear Sam

You are right about the persistent function, i have corrected it and try with the default options. I found the toolbox terminate with some local mins as follows.
[420.97 420.97 420.97 -302.53 420.97 420.97 420.97 -500 420.97 420.97 420.97 -302.52] ( Theoritical global min is 420.97).

So, I presume that the toolbox can works well with 12 inputs given that the suitable pso variables are defined.
Now I move to use it with my real obj function having single objective function subject to lb and ub for 12 inputs (this objective function already worked with fmincon (alone)). The error when used with you pso toolbox is as follows.

%%%%%%%%%%%%%%%%%%%%%%%%%
Swarming...??? Attempted to access Swarm(3); index out of bounds because numel(Swarm)=2.

Error in ==> vMarkSqr_spineCT_pso_mod at 37
vThoracicTransl=[Swarm(1);Swarm(2);Swarm(3)];

Error in ==> overlaysurface at 13
ZZ(i,j) = fitnessfcn([XX(i,j) YY(i,j)]) ;

Error in ==> psoplotswarmsurf at 30
overlaysurface(state.fitnessfcn,options) ;

Error in ==> pso at 334
state = options.PlotFcns{i}(options,state,flag) ;

Error in ==> psodemo at 61
pso(problem);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"Swarm" is my optimized parameterers.
The words "Error in ==> vMarkSqr_spineCT_pso_mod at 37
vThoracicTransl=[Swarm(1);Swarm(2);Swarm(3)];" is all about my objective codes and line 37 is very first line of my main calculation.
I think this is a problem between the default swarm dimension of the toolbox and the input dimension of my obj function. My function starts with simple head line as follows. Anything should be changed? It is not convenient to sent the whole function to you but I can explain how it works as follows.

%%%%%%%%%%%%%%%%%%
function LeastSqr = vMarkSqr_spineCT_pso_mod(Swarm)
%%%%%%%%%%%%%%%%%%

This obj function is the calculation based on multiple transformation matrices similar as the one from biomechanical application which you may have known it as "ankle joint parameters solving using parallel global optimization with particle swarm". In the main obj function, other 3 functions (created by my self) are called and all deals with transformation matrices with each matrix is calculated from (3-5) swarm inputs.

Could you please help comment about this?

02 May 2010 Another Particle Swarm Toolbox Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox. Author: Sam

Hi Sam,

Many thanks for your feedback:) Now I'm back to start from a test function which its answer is known. I found your toolbox easy to use with 2-11 inputs and suitable populationsize and generation are needed to help the finding of global min. Now, I got problem with 12 inputs, populationsize=50 and generation=from 2000 to 8000. If you could help to comment how to define suitable pso variables to achieve global min.
-----------------------------------
Eror:
The value of the fitness function did not improve in the last 50 generations and maximum constraint violation is less than 1e-006, after 61 generations.
-------------------------------------------------------

The code for test function is below and subject to lb = -500 and ub=500 (as you know, in same dimension with input number).

%%%%%%%%%%%%%%%%%%%%%%%
function f = easyTest(x)
[xSize, Dim] = size(x);
persistent sumX
for j=1:Dim
fx = (-x(j)) * sin(sqrt(abs(x(j))));
sumX = sumX+fx;
end
f = sumX;
%%%%%%%%%%%%%%%%%%%%%%%%

Contact us