Package ec.pso

# Class PSOBreeder

java.lang.Object
ec.Breeder
ec.pso.PSOBreeder

All Implemented Interfaces:
  `Setup`, `Singleton`, `Serializable`

public class PSOBreeder extends Breeder
PSOBreeder is a simple single-threaded Breeder which performs Particle Swarm Optimization using the Particle class as individuals. PSOBreeder relies on a number of parameters which define weights for various vectors computed during Particle Swarm Optimization, plus a few flags:

- Neighborhoods for particles have a size S determined by the parameter neighborhood-size. It's best if S were even.
- Neighborhoods for particles are constructed in one of three ways:
  - random: pick S informants randomly without replacement within the subpopulation, not including the particle itself, once at the beginning of the run.
  - random-each-time: pick S informants randomly without replacement within the subpopulation, not including the particle itself, every single generation.
  - toroidal: pick the floor(S/2) informants to the left of the particle's location within the subpopulation and the ceiling(S/2) informants to the right of the particle's location in the subpopulation, once at the beginning of the run.
- To this you can add the particle itself to the neighborhood, with include-self.
- The basic velocity update equation is VELOCITY invalid input: '<'-- (VELOCITY * velocity-coefficent) + (VECTOR-TO-GLOBAL-BEST * global-coefficient) + (VECTOR-TO-NEIGHBORHOOD-BEST * informant-coefficient) + (VECTOR-TO-PERSONAL-BEST * personal-coefficient)
- The basic particle update equation is PARTICLE invalid input: '<'-- PARTICLE + VELOCITY

Parameters

base.`velocity-coefficient` float ≥ 0 | (The weight for the velocity)
base.`personal-coefficient` float ≥ 0 | (The weight for the personal-best vector)
base.`informant-coefficient` float ≥ 0 | (The weight for the neighborhood/informant-best vector)
base.`global-coefficient` float ≥ 0 | (The weight for the global-best vector)
base.`neighborhood-size` int > 0 | (The size of the neighborhood of informants, not including the particle)
base.`neighborhood-style` String, one of: random toroidal random-each-time | (The method of generating the neighborhood of informants, not including the particle)
base.`include-self` true or false (default) | (Whether to include the particle itself as a member of the neighborhood after building the neighborhood)

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `C_NEIGHBORHOOD_RANDOM`
  `static final int`
  `C_NEIGHBORHOOD_RANDOM_EACH_TIME`
  `static final int`
  `C_NEIGHBORHOOD_TOROIDAL`
  `double[][]`
  `globalBest`
  `Fitness[]`
  `globalBestFitness`
  `double`
  `globalCoeff`
  `boolean`
  `includeSelf`
  `double`
  `informantCoeff`
  `int`
  `neighborhood`
  `int`
  `neighborhoodSize`
  `static final String`
  `P_GLOBAL_COEFFICIENT`
  `static final String`
  `P_INCLUDE_SELF`
  `static final String`
  `P_INFORMANT_COEFFICIENT`
  `static final String`
  `P_NEIGHBORHOOD`
  `static final String`
  `P_NEIGHBORHOOD_SIZE`
  `static final String`
  `P_PERSONAL_COEFFICIENT`
  `static final String`
  `P_VELOCITY_COEFFICIENT`
  `double`
  `personalCoeff`
  `static final String`
  `V_NEIGHBORHOOD_RANDOM`
  `static final String`
  `V_NEIGHBORHOOD_RANDOM_EACH_TIME`
  `static final String`
  `V_NEIGHBORHOOD_TOROIDAL`
  `double`
  `velCoeff`

  ### Fields inherited from class ec.Breeder

  `sequentialBreeding`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PSOBreeder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Population`
  `breedPopulation(EvolutionState state)`
  Breeds state.population, returning a new population.
  `void`
  `setup(EvolutionState state, Parameter base)`
  Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.

  ### Methods inherited from class ec.Breeder

  `shouldBreedSubpop`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### C_NEIGHBORHOOD_RANDOM

    public static final int C_NEIGHBORHOOD_RANDOM
    See Also:
      - Constant Field Values

  - ### C_NEIGHBORHOOD_TOROIDAL

    public static final int C_NEIGHBORHOOD_TOROIDAL
    See Also:
      - Constant Field Values

  - ### C_NEIGHBORHOOD_RANDOM_EACH_TIME

    public static final int C_NEIGHBORHOOD_RANDOM_EACH_TIME
    See Also:
      - Constant Field Values

  - ### P_VELOCITY_COEFFICIENT

    public static final String P_VELOCITY_COEFFICIENT
    See Also:
      - Constant Field Values

  - ### P_PERSONAL_COEFFICIENT

    public static final String P_PERSONAL_COEFFICIENT
    See Also:
      - Constant Field Values

  - ### P_INFORMANT_COEFFICIENT

    public static final String P_INFORMANT_COEFFICIENT
    See Also:
      - Constant Field Values

  - ### P_GLOBAL_COEFFICIENT

    public static final String P_GLOBAL_COEFFICIENT
    See Also:
      - Constant Field Values

  - ### P_INCLUDE_SELF

    public static final String P_INCLUDE_SELF
    See Also:
      - Constant Field Values

  - ### P_NEIGHBORHOOD

    public static final String P_NEIGHBORHOOD
    See Also:
      - Constant Field Values

  - ### P_NEIGHBORHOOD_SIZE

    public static final String P_NEIGHBORHOOD_SIZE
    See Also:
      - Constant Field Values

  - ### V_NEIGHBORHOOD_RANDOM

    public static final String V_NEIGHBORHOOD_RANDOM
    See Also:
      - Constant Field Values

  - ### V_NEIGHBORHOOD_TOROIDAL

    public static final String V_NEIGHBORHOOD_TOROIDAL
    See Also:
      - Constant Field Values

  - ### V_NEIGHBORHOOD_RANDOM_EACH_TIME

    public static final String V_NEIGHBORHOOD_RANDOM_EACH_TIME
    See Also:
      - Constant Field Values

  - ### neighborhood

    public int neighborhood

  - ### velCoeff

    public double velCoeff

  - ### personalCoeff

    public double personalCoeff

  - ### informantCoeff

    public double informantCoeff

  - ### globalCoeff

    public double globalCoeff

  - ### neighborhoodSize

    public int neighborhoodSize

  - ### includeSelf

    public boolean includeSelf

  - ### globalBest

    public double[][] globalBest

  - ### globalBestFitness

    public Fitness[] globalBestFitness

- ## Constructor Details

  - ### PSOBreeder

    public PSOBreeder()

- ## Method Details

  - ### setup

    public void setup(EvolutionState state, Parameter base)
    Description copied from interface: `Setup`
    Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.

  - ### breedPopulation

    public Population breedPopulation(EvolutionState state)
    Description copied from class: `Breeder`
    Breeds state.population, returning a new population. In general, state.population should not be modified.
    Specified by:
      `breedPopulation` in class `Breeder`