**Introduction**As we have discussed the difference between the conventional optimization algorithms and the unconventional algorithms are summarized below.

1.The conventional algorithms start from a single initial feasible solution where as the unconventional algorithms start with a set of initial(feasibility not a prerequisite) solutions.

2.The conventional algorithms need the function to be continuously differentiable through out the range of search.

3.The accuracy of the conventional algorithms depending on the selection of initial solution.Always a local solution is assured. The performance of the unconventional algorithms will vary for every run. A solution is assured.It may be local or global.Very rarely diverges.

**Particle Swarm Optimization(PSO)**This PSO algorithm also one of the important unconventional optimization algorithms.PSO optimizes a problem by having a population of candidate solutions, here dubbed particles, and moving these particles around in the search-space according to simple mathematical formulae. The movements of the particles are guided by the best found positions in the search-space which are updated as better positions are found by the particles.

PSO is originally attributed to Kennedy, Eberhart and Shi and was first intended for simulating social behaviour. The algorithm was simplified and it was observed to be performing optimization. The book by Kennedy and Eberhart describes many philosophical aspects of PSO and swarm intelligence.

As I am more interested in the implementation of this algorithm interested readers can get more details in the web regrading this algorithm.To implement PSO you neeed not know anything about the algorithm,you should know how to use the code to solve your modelled problem.

**PSO Code in MATLAB**There are so many variants of this PSO the code which I found simple and powerful is the vectorised PSO Toolbox by Mr Brian Birge.I thank him for the excellent toolbox.It can be downloaded from the link.

Just download it and unzip it as a folder.You can either add it to MATLAB path or make it as the default folder.

**Solving an Optimization problem by PSO**For implementing most of the unconventional algorithms(including the PSO) follow the steps.

1. Model the problem as unconstrained minimization problem( you can refer my earlier post on MATLAB GA toolbox ).

2. Write it as a function file.There are two types of functiones (i) scalar function(ii)vector function

In the scalar function for for every value of X the corresponding function value is returned.

X1-----------F(X1)

In the vector function for for every set of X values the corresponding function values are returned.

[X1 X2 X3 X4...Xn]-------------[F(X1),F(X2),F(X3),F(X4)...F(Xn)]

**The code by Mr Brian Birge requires a vector function file .****3.After writing the function file save it in the same PSO folder and change it as default.**

The toolbox has lot of details regarding the setting..

4.Run it .You get the solution as well the progressive graphs( iteration vs best solution and movement of particles in two dimension) .

I

**mplementation**

The same problem discussed in GA tool box is considered. Same way two files have to be written the first one is the pso setting file(test1.m) .This calls the subroutine vector function file ex2.m.

__program 1 test1.m__clc

% lower limir

l=[0 0];

% upper limit

u=[ 10 10];

ran=[l' u'];

% number of variables

n=2;

% settings for pso

%1. population,2. no of iterations,3 refresh on screen 4&5 type of PSO 06&7

%are final and initial swarm velocity 8. final iteration to reach final

%velocity 9. expected function value

Pdef = [20 200 10 2 2 0.9 0.4 200 50 5000 NaN 0 0];

[OUT]=pso_Trelea_vectorized('ex2',n,1,ran,0,Pdef);

out=abs(OUT)

P=out(1:n)

[F x]=ex2(P')

__Program 2 vector function file ex2.m__function [F x]=ex2(x);

F=sum((x.*x).').'+1000*((sum(x')-10))^2;

Results

PSO: 1/200 iterations, GBest = 100.

PSO: 20/200 iterations, GBest = 52.210493585432118.

PSO: 40/200 iterations, GBest = 50.166913798388642.

PSO: 60/200 iterations, GBest = 49.997052264769565.

PSO: 80/200 iterations, GBest = 49.978589042793075.

PSO: 100/200 iterations, GBest = 49.978455656591841.

PSO: 120/200 iterations, GBest = 49.975851601760063.

PSO: 140/200 iterations, GBest = 49.975342456412399.

PSO: 160/200 iterations, GBest = 49.975036994685418.

PSO: 180/200 iterations, GBest = 49.97501323855063.

PSO: 200/200 iterations, GBest = 49.975012959884864.

out =

4.99798359369474

4.99701881234046

49.97501295916326

P =

4.99798359369474

4.99701881234046

F =

49.97501295916326

x =

4.99798359369474 4.99701881234046

**You are welcome to make some suggestions .All the best.**

## 27 comments:

It's a pity you don't have a donate button! I'd certainly donate to this brilliant blog! I guess for now i'll settle for bookmarking

and adding your RSS feed to my Google account. I

look forward to fresh updates and will talk about

this site with my Facebook group. Talk soon!

Here is my site ... Resort Management Association

What's up i am kavin, its my first occasion to commenting anyplace, when i read this article i thought i could also make comment due to this brilliant paragraph.

Feel free to surf to my blog post ... natox cream

I'm truly enjoying the design and layout of your blog. It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often.

Did you hire out a designer to create your theme?

Exceptional work!

my homepage: aqui

It's remarkable to go to see this web site and reading the views of all colleagues concerning this piece of writing, while I am also eager of getting know-how.

Feel free to surf to my weblog: Buy dermal meds

Hey there would you mind letting me know which web host you're using? I've loaded your blog in 3 different internet browsers and

I must say this blog loads a lot faster then most. Can you recommend a good hosting provider at a reasonable price?

Thank you, I appreciate it!

Feel free to visit my page ... Raspberry ketone Reviews

Hello There. I found your blog using msn. This is a really well written article.

I will make sure to bookmark it and come back to

read more of your useful information. Thanks for the post.

I will certainly return.

Also visit my web blog: testforcextremeblog.org

This design is spectacular! You obviously know how to keep

a reader amused. Between your wit and your videos, I was almost moved to

start my own blog (well, almost...HaHa!) Fantastic job.

I really loved what you had to say, and more than that, how you presented it.

Too cool!

Feel free to surf to my web page :: Buy Xtrasize

These are really wonderful ideas in about blogging.

You have touched some good points here. Any way keep up wrinting.

Look into my web blog; Online Home Careers Reviews

I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone

to do it for you? Plz reply as I'm looking to construct my own blog and would like to know where u got this from. thanks a lot

my website; Internet Money Path Review

I think what you said made a ton of sense. But, what about this?

suppose you composed a catchier post title? I ain't suggesting your information isn't good, however what if you added a post title that grabbed people's attention? I mean "Solving Optimization Problems Using PSO algorithm." is a little plain. You could look at Yahoo's front page

and note how they create article titles to get people to

click. You might add a video or a pic or two to get people interested about everything've got to say. Just my opinion, it could make your website a little livelier.

Look at my blog post: Zinn collection

Hi would you mind sharing which blog platform you're working with? I'm going to start my own blog soon but I'm having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for

something unique. P.S Sorry for being off-topic but I

had to ask!

My homepage Order Nuvocleanse

Thanks for finally writing about > "Solving Optimization Problems Using PSO algorithm." < Loved it!

Also visit my weblog Mito slim reviews

It's perfect time to make some plans for the longer term and it is time to be happy. I've read this post and if I

could I desire to suggest you some interesting issues

or tips. Maybe you can write subsequent articles regarding this article.

I want to learn even more issues approximately it!

Feel free to surf to my homepage: Pur Essence Anti Aging

Pretty section of content. I just stumbled upon your web site and in accession capital to assert that I

acquire actually enjoyed account your blog posts.

Any way I will be subscribing to your augment and even I achievement you access consistently quickly.

my web blog ... muscle builder

It's not my first time to visit this website, i am browsing this site dailly and take pleasant facts from here all the time.

Here is my web-site - fat burnig pills

Hi,

i try to run using both of the files as you given above..but have errors.. Any idea please?

??? Error using ==> mpower

Inputs must be a scalar and a square matrix.

Error in ==> ex2 at 2

F=sum((x.*x).').'+1000*((sum(x')-10))^2;

Error in ==> pso_Trelea_vectorized at 267

out = feval(functname,pos); % returns column of cost values (1 for each particle)

Error in ==> test1 at 15

[OUT]=pso_Trelea_vectorized('ex2',n,1,ran,0,Pdef);

Sir,

my project is entitled as "Optimal Allocation And Contingency Analysis Of Embedded Generation Deployment In Distribution Network Using Particle Swarm Optimization"

.I need some mathematical example of Particle swarm optimization...Please sir

..my mail Id is "tgn255u@gmail.com"

Hi,

thanks for your post. This seems really useful, for me to start experimenting with PSO. However, I got the same error, as stated in the comments

Hi,

i try to run using both of the files as you given above..but have errors.. Any idea please?

??? Error using ==> mpower

Inputs must be a scalar and a square matrix.

Error in ==> ex2 at 2

F=sum((x.*x).').'+1000*((sum(x')-10))^2;

Error in ==> pso_Trelea_vectorized at 267

out = feval(functname,pos); % returns column of cost values (1 for each particle)

Error in ==> test1 at 15

[OUT]=pso_Trelea_vectorized('ex2',n,1,ran,0,Pdef);

Can you please help me?

hii

pls can u help me with the pso coding for hydrothermal scheduling?

Great post ! It would be easier to understand the algorithm if you provided a mathematical example

I am feeling happy to comment on this post. This blog is really great one.

SEO Bangalore|SEO Services BangalorePlease can anyone help me with the PSO. Code for maximum loadability of the IEEE 14 bus system?

can u pls help me. i want pso mathematical examples and some codings of matlab.my mail id prskalai@gmail.com

pls any one help me sir/madam...manual calculation of ode problem using pso algorthim,very urgent in my m.sc project..pls help me

Very useful information. Thanks for sharing such a amazing post.

web design company in chennai

Hi,

Thanks for sharing a very interesting article about Solving Optimization Problems Using PSO algorithm. This is very useful information for online blog review readers. Keep it up such a nice posting like this.

From,

Maestro Infotech,

Best Web Design Company in Bangalore

## Post a Comment