0

Edit Hi, I am trying to implement Particle (or Genetical) Swarm Optimization. However, I am already stuck in the first step...

I am getting confused on how to initialise the particles, and what these particles (in terms of code) are.

I've found various information on the algorithm (on its own) and implementation, but didn't find the information I want...

Can anyone explain, please?

Thanks.

Andrea.

  • I'm not totally sure what you mean, but if you are asking "How do I represent each particle in my program", then you will probably want them to be objects of a class that you will write. For example, you may have a "Particle" class that contains the position and state information for that particle, and then you will have a collection of those particles, and on each new iteration of the algorithm you can loop through that collection to do whatever has to happen to each particle. If that answers your question let me know and I'll write up a full answer to that effect – Kevin Feb 08 '16 at 21:31
  • 1
    Hi Kevin, Spot on... That's what I meant. I found numerous topics on PSO / GSO and some variants of the algorithm, as well as conceptual info. However, I couldn't figure out, how to represent such particles... I have a clearer idea now, still am a bit shaky (to say the least), but I am able to start reasoning on PSO / GSO... Thanks a lot for your answer... – Andrea Montesin Feb 09 '16 at 21:25

2 Answers2

1

If you are familiar with Python, I learned genetic algorithms and pso using deap. They have some excellent tutorials and docs.

Definition: 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.

What is a particle?

A particle has a current position, velocity, and a record of past positions. Each particle has its own velocity and position update rules.

How does the optimization search work?

You run the algorithm for a given number of iterations. On each iteration update each particle's velocity and position. Then hope you find the best solution or a solution that is good enough.

Concrete example.

Imagine that your search objective is to find the star. At each iteration we find the particle that is closest to finding the star. Then move all the other particles in that direction.

PSO Pic

Image courtesy of wirelesstech

goCards
  • 1,388
  • 9
  • 10
0

if you are asking "How do I represent each particle in my program", then you will probably want them to be objects of a class that you will write. For example, you may have a "Particle" class that contains the position and state information for that particle, and then you will have a collection of those particles, and on each new iteration of the algorithm you can loop through that collection to do whatever has to happen to each particle. – Kevin Wells

Armali
  • 18,255
  • 14
  • 57
  • 171