The folder contain the Quantum PSO main code (QPSO) and 11 functions for benchmark.
fun = @griewankfcn;
D = 30;
nPop = 50;
lb = -600;
ub = 600;
maxit = 1000;
maxeval = 10000*D;
[xmin,fmin,histout] = QPSO(fun,D,nPop,lb,ub,maxit,maxeval);
[xmin,fmin,histout] = QPSO(@griewankfcn,30,50,-600,600,1000,10000*30);
Khurram, just modify the code:
x = unifrnd([lb,ub],[nPop,D]);
A rudimentary PSO variant, with just one implicit fixed topology, which is far to be the best one for multimodal problems. Actually, it works well only on biased functions. It might be useful to understand the basic principles of PSO, but not for real world applications.
Also, I do not understand why it is called "quantum". There is no qbits, no superposition, no entanglement, no unitary operators (quantum gates).
lb=[0 5 10];ub=[0 25 100];D=3;nPop=50;
Index exceeds matrix dimensions.
Error in QPSO (line 74)
p = (c1*fi.*pbest(i,:) + c2*(1-fi).*gbest)/(c1 + c2);
Error in Run_sim_QEG (line 449)
[xmin,fmin,histout] = QPSO(Fobj,dim,nPop,lb,ub,maxit,C1,C2);
It is showing this error.
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to
change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Error in QPSO
Thanks for the code. But I wanna ask a question, why update the position, not through quantum rotation gate? Do you have the code whose evolutionary process of quantum position is computed through quantum rotation gate? Thank you very much! I really need it. Thanks a lot
@Christophe Granet you can use x = (ub-lb).*rand(nPop,D) + lb;
There was no mention of the requirement to have access to the "Statistics Toolbox" when downloading the files. However, I get this error message when I try to run the program: To use 'unifrnd', you might need:
unifrnd - Statistics Toolbox
Is there a way to have this running without the need to purchase the "Statistic Toolbox"?
This code is impressive. Thanks a lot!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!