# Developers Planet

Andrea Montesin February 2016

### What are the particles (code wise) in Particle / Genetical Swarm Optimization algorithm?

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

Thanks.

Andrea.

goCards February 2016

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

Image courtesy of wirelesstech