File Exchange

image thumbnail

Quantum-Behaved Particle Swarm Optimization

version 1.0.0 (6.46 KB) by David Franco
The Q-PSO function + 11 benchmark functions.

12 Downloads

Updated 18 Oct 2018

View License

The folder contain the Quantum PSO main code (QPSO) and 11 functions for benchmark.

EXAMPLE:

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);

OR DIRECTLY:

[xmin,fmin,histout] = QPSO(@griewankfcn,30,50,-600,600,1000,10000*30);

Comments and Ratings (8)

David Franco

Khurram, just modify the code:
x = unifrnd([lb,ub],[nPop,D]);

Maurice

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).

Khurram Shahzad Sana

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);

Sajad Ahmad Rather

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

Carmelon

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

David Franco

@Christophe Granet you can use x = (ub-lb).*rand(nPop,D) + lb;

Christophe Granet

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"?

Mark Stevenson

This code is impressive. Thanks a lot!

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!