ec.pso
Class PSOBreeder
- java.lang.Object
-
- ec.Breeder
-
- ec.pso.PSOBreeder
-
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 <-- (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 <-- 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 and Description static intC_NEIGHBORHOOD_RANDOMstatic intC_NEIGHBORHOOD_RANDOM_EACH_TIMEstatic intC_NEIGHBORHOOD_TOROIDALdouble[][]globalBestFitness[]globalBestFitnessdoubleglobalCoeffbooleanincludeSelfdoubleinformantCoeffintneighborhoodintneighborhoodSizestatic java.lang.StringP_GLOBAL_COEFFICIENTstatic java.lang.StringP_INCLUDE_SELFstatic java.lang.StringP_INFORMANT_COEFFICIENTstatic java.lang.StringP_NEIGHBORHOODstatic java.lang.StringP_NEIGHBORHOOD_SIZEstatic java.lang.StringP_PERSONAL_COEFFICIENTstatic java.lang.StringP_VELOCITY_COEFFICIENTdoublepersonalCoeffstatic java.lang.StringV_NEIGHBORHOOD_RANDOMstatic java.lang.StringV_NEIGHBORHOOD_RANDOM_EACH_TIMEstatic java.lang.StringV_NEIGHBORHOOD_TOROIDALdoublevelCoeff
-
Constructor Summary
Constructors Constructor and Description PSOBreeder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PopulationbreedPopulation(EvolutionState state)Breeds state.population, returning a new population.voidsetup(EvolutionState state, Parameter base)Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.
-
-
-
Field Detail
-
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 java.lang.String P_VELOCITY_COEFFICIENT
- See Also:
- Constant Field Values
-
P_PERSONAL_COEFFICIENT
public static final java.lang.String P_PERSONAL_COEFFICIENT
- See Also:
- Constant Field Values
-
P_INFORMANT_COEFFICIENT
public static final java.lang.String P_INFORMANT_COEFFICIENT
- See Also:
- Constant Field Values
-
P_GLOBAL_COEFFICIENT
public static final java.lang.String P_GLOBAL_COEFFICIENT
- See Also:
- Constant Field Values
-
P_INCLUDE_SELF
public static final java.lang.String P_INCLUDE_SELF
- See Also:
- Constant Field Values
-
P_NEIGHBORHOOD
public static final java.lang.String P_NEIGHBORHOOD
- See Also:
- Constant Field Values
-
P_NEIGHBORHOOD_SIZE
public static final java.lang.String P_NEIGHBORHOOD_SIZE
- See Also:
- Constant Field Values
-
V_NEIGHBORHOOD_RANDOM
public static final java.lang.String V_NEIGHBORHOOD_RANDOM
- See Also:
- Constant Field Values
-
V_NEIGHBORHOOD_TOROIDAL
public static final java.lang.String V_NEIGHBORHOOD_TOROIDAL
- See Also:
- Constant Field Values
-
V_NEIGHBORHOOD_RANDOM_EACH_TIME
public static final java.lang.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
-
-
Method Detail
-
setup
public void setup(EvolutionState state, Parameter base)
Description copied from interface:SetupSets 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:BreederBreeds state.population, returning a new population. In general, state.population should not be modified.- Specified by:
breedPopulationin classBreeder
-
-
DMelt 3.0 © DataMelt by jWork.ORG