Search code examples
javanumericalparticle-swarm

Particle Swarm Optimization


I'm using Particle Swarm Optimization(PSO) in java. I am having little knowledge about what we do. Since, I am applying for multiple sequence alignment in bioinformatics.

We need to find position and velocity for aligning those sequences. I need detailed explanation and references about PSO and the need for calculating velocity and position in PSO. If possible I need simple example explaining PSO in java. Actually, I need to understand how it optimizes a problem.

public class Position {
 private double x;
 private double y;

 public Position(double x, double y) {
 this.x = x;
 this.y = y;
 }

 public double getX() {
 return x;
 }

 public void setX(double x) {
 this.x = x;
 }

 public double getY() {
 return y;
 }

 public void setY(double y) {
 this.y = y;
 }
}

Here is the class for representing the position of the particle with getters and setters

Like wise other classes are available here


Solution

  • Particle Swarm Optimization:

    1. randomly initialize a set of particles at random positions in the search space;
    2. evaluate all positions and update the global best position and the personal best positions;
    3. update each velocity based on the relative position of the global best position, the current velocity of the particle, the personal best position of the particle and some random vector;
    4. goto 2.