View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Particle Swarm Optimization

  • Demofunction: demo function to show the effectivenees of pso in solving the ackley non-convex function
  • ackley(in)function: Ackley's function, from
  • pso(fun,np,lb,ub,inertia,...function: Find the minimum value of the cost function using pso algorithm
  • View all files
5.0 | 1 rating Rate this file 24 Downloads (last 30 days) File Size: 8.01 KB File ID: #41708 Version: 1.13
image thumbnail

Particle Swarm Optimization


Yan Ou (view profile)


13 May 2013 (Updated )

[xMin,yMin] = pso(fun,np,lb,ub);

| Watch this File

File Information

fun: function handle (y = fun(x), x is column vector)
np: number of particles
lb, ub: lb<x<ub
xMin: yMin = fun(xMin)
yMin: minimum value of the cost function fun
pso finds the global minimum for a constraint function (convex or non-con) with multiple variables.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
21 Dec 2016 Haitham Hassan

How can i Multiobjective function each with different constraints ?

Comment only
12 Sep 2014 Maria Esmeral

Good Morning.

I want to know if for using this function should I have instaled the optimization toolbox.

Thank you

Comment only
03 Mar 2014 Quan Wang

Quan Wang (view profile)

Very elegant implementation.

29 Jan 2014 Yan Ou

Yan Ou (view profile)

It dose constrain stuff. lb, ub: lb<x<ub

Comment only
16 Jan 2014 li jian

Hi,thanks for your contribution. The pso algorithm does not deal with constrained problems which makes it powerless to deal with practical problems.

Comment only
18 Dec 2013 Sukhoon

oops...I may control the different LB & UB at the inside of my own test function. Sorry to make you confused. Thanks!

Comment only
18 Dec 2013 Sukhoon

How many different lb & ub can I set for your PSO? If it is 1 set, so far, then I wonder if you hava a plan to update your PSO for that. Thanks!

Comment only
09 Dec 2013 Yan Ou

Yan Ou (view profile)

Hello Sanjaya:

The pso algorithm I posted does not deal with the integer programming issue as you mention.
But there should be two way to solve your problem.
1, Your problem have 5 variable restrict in integer domain. You can try all the combination of the 5 variable and use pso to solve the continuous optimization problem for the rest 9 variables. Then choose the smallest one from the 5 variables.
2, Try to relax your integer programming issue to a continuous programming issue.

Comment only
09 Dec 2013 sanjaya

Dear sir,
I have a problem with 16 variables, out of which 9 variables are in decimals with range 0 to 1 and the rest are integers with range 1 to 4. Can I use your codings of pso?

Comment only
04 Dec 2013 Ahmed ali


Comment only
16 May 2013 Yan Ou

Yan Ou (view profile)

Please let me know if you guys can run the function or not

Comment only
16 May 2013 Yan Ou

Yan Ou (view profile)

Please let me know if you guys can run the function or not

Comment only
14 May 2013 1.1

change the summary part to make user immediately understand the usage of function

14 May 2013 1.3

add screen shot and summary

06 Nov 2013 1.4

updated version

25 Nov 2013 1.7


05 Dec 2013 1.8

Add demo file

06 Dec 2013 1.9

update pso

09 Dec 2013 1.10


17 Dec 2013 1.11

add warm start

18 Dec 2013 1.12

update stop criteria

24 Dec 2013 1.13


Contact us