Class BasicSwarm<PosType,ParType>
java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm<PosType,ParType>
- Type Parameters:
PosType
- the type of position vector of each particleParType
- the type of particle implemented in PSO algorithm
The abstract class contains the main methods and fields that are used in all
PSO-based feature selection methods. This class is used to implement a swarm
of particles in PSO algorithm.
- Author:
- Sina Tabakhi
-
Field Summary
Modifier and TypeFieldDescriptionprotected static double
protected static double
protected static double
static FitnessEvaluator
protected PosType[]
protected static double
protected static double
protected static double
protected ParType[]
protected static int
static int
protected static double
-
Constructor Summary
ConstructorDescriptionBasicSwarm
(Class<PosType> pos, Class<ParType> par) Initializes the parameters -
Method Summary
Modifier and TypeMethodDescriptionabstract void
This method evaluates the fitness of each particle in the swarm by predefined fitness function.PosType[]
getGBest()
This method returns the best position in the swarm (global best)double
This method returns the fitness value of best position in the swarm (global best)abstract void
This method initializes the position and velocity vectors of each particle in the swarm.void
This method sets the best position in the swarm (global best)void
setGBestFitness
(double gBestFitness) This method sets the fitness value of best position in the swarm (global best)abstract void
This method updates the global best position (global best) of the swarm.abstract void
This method updates the position vector of each particle in the swarm.abstract void
This method updates the velocity vector of each particle in the swarm.abstract void
This method updates the best position (personal best) of each particle in the swarm.
-
Field Details
-
population
-
gBest
-
fitnessEvaluator
-
PROBLEM_DIMENSION
public static int PROBLEM_DIMENSION -
POPULATION_SIZE
protected static int POPULATION_SIZE -
INERTIA_WEIGHT
protected static double INERTIA_WEIGHT -
C1
protected static double C1 -
C2
protected static double C2 -
START_POS_INTERVAL
protected static double START_POS_INTERVAL -
END_POS_INTERVAL
protected static double END_POS_INTERVAL -
MIN_VELOCITY
protected static double MIN_VELOCITY -
MAX_VELOCITY
protected static double MAX_VELOCITY
-
-
Constructor Details
-
BasicSwarm
Initializes the parameters- Parameters:
pos
- the type of position vector of each particlepar
- the type of particle implemented in PSO algorithm
-
-
Method Details
-
initialization
public abstract void initialization()This method initializes the position and velocity vectors of each particle in the swarm. -
evaluateFitness
public abstract void evaluateFitness()This method evaluates the fitness of each particle in the swarm by predefined fitness function. -
updatePersonalBest
public abstract void updatePersonalBest()This method updates the best position (personal best) of each particle in the swarm. -
updateGlobalBest
public abstract void updateGlobalBest()This method updates the global best position (global best) of the swarm. -
updateParticleVelocity
public abstract void updateParticleVelocity()This method updates the velocity vector of each particle in the swarm. -
updateParticlePosition
public abstract void updateParticlePosition()This method updates the position vector of each particle in the swarm. -
getGBest
This method returns the best position in the swarm (global best)- Returns:
- the best position in the swarm
-
setGBest
This method sets the best position in the swarm (global best)- Parameters:
gBest
- the best position in the swarm
-
getGBestFitness
public double getGBestFitness()This method returns the fitness value of best position in the swarm (global best)- Returns:
- the fitness value of best position in the swarm
-
setGBestFitness
public void setGBestFitness(double gBestFitness) This method sets the fitness value of best position in the swarm (global best)- Parameters:
gBestFitness
- the fitness value of best position in the swarm
-