constrained pso : how to set initial population ?

8 views (last 30 days)
hi, i tried
options = optimoptions('particleswarm', 'InitialPopulation', tous_xi);
where tous_xi contains initial positions, and i get the error :
'InitialPopulation' is not an option for PARTICLESWARM.
Can you help me to set that initial population? Thank you
  8 Comments
genevois pierre
genevois pierre on 3 Jan 2017
Edited: Walter Roberson on 21 Feb 2017
hi, i switched from my laptop (Matlab R2015b) to my office's PC (Matlab R2013a) : i will use Matlab R2013a from now on. Does this change in Matlab version changes something to your last message ?
The constraints can be satisfied, because i get no problem when i use ga instead of pso.
With Matlab R2013a, when i run
options_pso = psooptimset(@pso);
options_pso = psooptimset('InitialPopulation', tous_xi);
[x, fval, exitflag] = pso(@mapse_vu_sd, 7, [], [], [], [], ...
lx, ux, @mapse_CNL_sd_c, options_pso)
the error is
Error using psocheckinitialpopulation (line 103)
Problem is infeasible due to nonlinear constraints
Error in pso (line 338)
[state,options] = psocheckinitialpopulation(state,...
Error in essai_pso_matlab (line 40)
[x, fval, exitflag] = pso(@mapse_vu_sd, 7, [], [], [], [], ...
but since there is no error due to the 2 lines that use psooptimset, it seems to mean that 'InitialPopulation' is not a problem ... Thank you again for your help.
Walter Roberson
Walter Roberson on 3 Jan 2017
The Mathworks routine is particleswarm() introduced in R2014b, which does not support constraints.
Someone would have to study the constrained pso() code to determine why it does not feel that the constraints can be satisfied. I do not feel that is something I would have time to do.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 30 Dec 2016
InitialSwarmMatrix is the option

More Answers (2)

jonas_h
jonas_h on 21 Feb 2017
Edited: Walter Roberson on 21 Feb 2017
Did you find a solution yet? I have the same problem. I am also using this PSO https://de.mathworks.com/matlabcentral/fileexchange/25986-constrained-particle-swarm-optimization because I need the nonlinear constraints.
I get the same error and thought I made a mistake but with ga everything is working fine (much slower but at least it is working). I tried the pso several times and sometimes it is working (maybe in 2/10 cases) In the other cases there is this error:
Error using psocheckinitialpopulation (line 103)
Problem is infeasible due to nonlinear constraints
Error in pso (line 338)
[state,options] = psocheckinitialpopulation(state,...
There are possibilieties where there constraints can be satiefies. Otherwise it would not be working in some cases.
After this I tried to set the initialpopulation:
psooptimset(...InitialPopulation',startwerte);
"startwerte" should be a vector of my starting values (the function contains 12 variables which should be optimized). With the starting values the constraints are 100% satisfied. This did not help very much. maybe it is working more often now but not everytime.
Is this a bug in the PSO? I think then I have to use the ga. I would like to use the PSO because it is much faster in my case.
Thanks!
  1 Comment
Walter Roberson
Walter Roberson on 21 Feb 2017
It would help to have specific functions (and inputs) to test with.

Sign in to comment.


genevois pierre
genevois pierre on 21 Feb 2017
I get the same problem ... probably due to the call to fmincon in psocheckinitialpopulation, line 99.

Community Treasure Hunt

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

Start Hunting!