hr.fer.diplomski.seminar.pso
Class Particle
java.lang.Object
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 |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 functionxMax
- maximum range in the spacexMin
- minimum range in the sapcevMax
- maximum speed (absolute value)rand
- random number generatorc1
- user defined constant defines weight factor of personal bestc2
- user defined constant defines weight of local best
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()