hr.fer.diplomski.seminar.pso
Class Particle

java.lang.Object
  extended by hr.fer.diplomski.seminar.pso.Particle

public class Particle
extends java.lang.Object


Constructor Summary
Particle(Function fitness, double xMax, double xMin, double vMax, java.util.Random rand, double c1, double c2)
          Particle's constructor
 
Method Summary
 void addNeighbours(java.util.List<Particle> list)
           
 int detBestNeighbour()
          Function determines best neighbour
 double getBestFit()
           
 double[] getBestPosition()
           
 void iteration()
          Method does one particle's iteration: 1.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Particle

public Particle(Function fitness,
                double xMax,
                double xMin,
                double vMax,
                java.util.Random rand,
                double c1,
                double c2)
Particle's constructor

Parameters:
eval - fitness function
xMax - maximum range in the space
xMin - minimum range in the sapce
vMax - maximum speed (absolute value)
rand - random number generator
c1 - user defined constant defines weight factor of personal best
c2 - user defined constant defines weight of local best
Method Detail

addNeighbours

public void addNeighbours(java.util.List<Particle> list)

detBestNeighbour

public int detBestNeighbour()
Function determines best neighbour

Returns:
index of the best neighbour in the neighbourhood list

iteration

public void iteration()
Method does one particle's iteration: 1. updates it speed 2. updates it's position 3. updates best known position


getBestPosition

public double[] getBestPosition()

getBestFit

public double getBestFit()