Class BasicSwarm<PosType,ParType>

java.lang.Object
unifeat.featureSelection.wrapper.PSOBasedMethods.BasicSwarm<PosType,ParType>
Type Parameters:
PosType - the type of position vector of each particle
ParType - the type of particle implemented in PSO algorithm
Direct Known Subclasses:
Swarm, Swarm, Swarm, Swarm

public abstract class BasicSwarm<PosType,ParType> extends Object
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 Details

    • population

      protected ParType[] population
    • gBest

      protected PosType[] gBest
    • gBestFitness

      private double gBestFitness
    • fitnessEvaluator

      public static FitnessEvaluator 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

      public BasicSwarm(Class<PosType> pos, Class<ParType> par)
      Initializes the parameters
      Parameters:
      pos - the type of position vector of each particle
      par - 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

      public PosType[] getGBest()
      This method returns the best position in the swarm (global best)
      Returns:
      the best position in the swarm
    • setGBest

      public void setGBest(PosType[] gBest)
      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