Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.ml.genetic.population
Class BasicPopulation

    java.lang.Object
      org.encog.ml.genetic.population.BasicPopulation

All Implemented Interfaces:
  Serializable, Population

Direct Known Subclasses:
  NEATPopulation

    public class BasicPopulation

extends Object
implements Population

Defines the basic functionality for a population of genomes.

See Also:
  Serialized Form

Field Summary
`static double` | `DEFAULT_OLD_AGE_PENALTY` Thed default old age penalty.
`static int` | `DEFAULT_OLD_AGE_THRESHOLD` The default old age threshold.
`static double` | `DEFAULT_SURVIVAL_RATE` The default survival rate.
`static double` | `DEFAULT_YOUTH_BONUS` The default youth penalty.
`static int` | `DEFAULT_YOUTH_THRESHOLD` The default youth threshold.

Fields inherited from interface org.encog.ml.genetic.population.Population
`PROPERTY_GENOMES, PROPERTY_INNOVATIONS, PROPERTY_NEXT_GENE_ID, PROPERTY_NEXT_GENOME_ID, PROPERTY_NEXT_INNOVATION_ID, PROPERTY_NEXT_SPECIES_ID, PROPERTY_OLD_AGE_PENALTY, PROPERTY_OLD_AGE_THRESHOLD, PROPERTY_POPULATION_SIZE, PROPERTY_SPECIES, PROPERTY_SURVIVAL_RATE, PROPERTY_YOUNG_AGE_BONUS, PROPERTY_YOUNG_AGE_THRESHOLD`

Constructor Summary
`BasicPopulation()` Construct an empty population.
`BasicPopulation(int thePopulationSize)` Construct a population.

Method Summary
`void` | `add(Genome genome)` Add a genome to the population.
`void` | `addAll(List<? extends Genome> newPop)` Add all of the specified members to this population.
`long` | `assignGeneID()`
`long` | `assignGenomeID()`
`long` | `assignInnovationID()`
`long` | `assignSpeciesID()`
`void` | `claim(GeneticAlgorithm ga)` Claim the population, before training.
`void` | `clear()` Clear all genomes from this population.
`Genome` | `get(int i)` Get a genome by index.
`Genome` | `getBest()`
`GenerateID` | `getGeneIDGenerate()`
`GenerateID` | `getGenomeIDGenerate()`
`List<Genome>` | `getGenomes()`
`GenerateID` | `getInnovationIDGenerate()`
`InnovationList` | `getInnovations()`
`String` | `getName()`
`double` | `getOldAgePenalty()`
`int` | `getOldAgeThreshold()`
`int` | `getPopulationSize()`
`List<Species>` | `getSpecies()`
`GenerateID` | `getSpeciesIDGenerate()`
`double` | `getSurvivalRate()`
`int` | `getYoungBonusAgeThreshold()`
`double` | `getYoungScoreBonus()`
`void` | `setInnovations(InnovationList theInnovations)` Set the innovations collection.
`void` | `setName(String theName)` Set the name.
`void` | `setOldAgePenalty(double theOldAgePenalty)` Set the old age penalty.
`void` | `setOldAgeThreshold(int theOldAgeThreshold)` Set the age at which a genome is considered "old".
`void` | `setPopulationSize(int thePopulationSize)` Set the max population size.
`void` | `setSurvivalRate(double theSurvivalRate)` Set the survival rate.
`void` | `setYoungBonusAgeThreshhold(int theYoungBonusAgeThreshold)` Set the age at which genoms are considered young.
`void` | `setYoungBonusAgeThreshold(int theYoungBonusAgeThreshold)`
`void` | `setYoungScoreBonus(double theYoungScoreBonus)` Set the youth score bonus.
`int` | `size()`
`void` | `sort()` Sort the population by best score.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_OLD_AGE_PENALTY

    public static final double DEFAULT_OLD_AGE_PENALTY

  Thed default old age penalty.

  See Also:
    Constant Field Values

### DEFAULT_OLD_AGE_THRESHOLD

    public static final int DEFAULT_OLD_AGE_THRESHOLD

  The default old age threshold.

  See Also:
    Constant Field Values

### DEFAULT_SURVIVAL_RATE

    public static final double DEFAULT_SURVIVAL_RATE

  The default survival rate.

  See Also:
    Constant Field Values

### DEFAULT_YOUTH_BONUS

    public static final double DEFAULT_YOUTH_BONUS

  The default youth penalty.

  See Also:
    Constant Field Values

### DEFAULT_YOUTH_THRESHOLD

    public static final int DEFAULT_YOUTH_THRESHOLD

  The default youth threshold.

  See Also:
    Constant Field Values

Constructor Detail

### BasicPopulation

    public BasicPopulation()

  Construct an empty population.

### BasicPopulation

    public BasicPopulation(int thePopulationSize)

  Construct a population.

  Parameters:
    `thePopulationSize` - The population size.

Method Detail

### add

    public final void add(Genome genome)

  Add a genome to the population.

  Specified by:
    `add` in interface `Population`
  Parameters:
    `genome` - The genome to add.

### addAll

    public final void addAll(List<? extends Genome> newPop)

  Add all of the specified members to this population.

  Specified by:
    `addAll` in interface `Population`
  Parameters:
    `newPop` - A list of new genomes to add.

### assignGeneID

    public final long assignGeneID()

  Specified by:
    `assignGeneID` in interface `Population`
  Returns:
    Assign a gene id.

### assignGenomeID

    public final long assignGenomeID()

  Specified by:
    `assignGenomeID` in interface `Population`
  Returns:
    Assign a genome id.

### assignInnovationID

    public final long assignInnovationID()

  Specified by:
    `assignInnovationID` in interface `Population`
  Returns:
    Assign an innovation id.

### assignSpeciesID

    public final long assignSpeciesID()

  Specified by:
    `assignSpeciesID` in interface `Population`
  Returns:
    Assign a species id.

### claim

    public final void claim(GeneticAlgorithm ga)

  Claim the population, before training.

  Specified by:
    `claim` in interface `Population`
  Parameters:
    `ga` - The GA that is claiming.

### clear

    public final void clear()

  Clear all genomes from this population.

  Specified by:
    `clear` in interface `Population`

### get

    public final Genome get(int i)

  Get a genome by index. Index 0 is the best genome.

  Specified by:
    `get` in interface `Population`
  Parameters:
    `i` - The genome to get.
  Returns:
    The genome at the specified index.

### getBest

    public final Genome getBest()

  Specified by:
    `getBest` in interface `Population`
  Returns:
    The best genome in the population.

### getGeneIDGenerate

    public final GenerateID getGeneIDGenerate()

  Returns:
    the geneIDGenerate

### getGenomeIDGenerate

    public final GenerateID getGenomeIDGenerate()

  Returns:
    the genomeIDGenerate

### getGenomes

    public final List<Genome> getGenomes()

  Specified by:
    `getGenomes` in interface `Population`
  Returns:
    The genomes in the population.

### getInnovationIDGenerate

    public final GenerateID getInnovationIDGenerate()

  Returns:
    the innovationIDGenerate

### getInnovations

    public final InnovationList getInnovations()

  Specified by:
    `getInnovations` in interface `Population`
  Returns:
    A list of innovations in this population.

### getName

    public final String getName()

  Returns:
    The name.

### getOldAgePenalty

    public final double getOldAgePenalty()

  Specified by:
    `getOldAgePenalty` in interface `Population`
  Returns:
    The percent to decrease "old" genom's score by.

### getOldAgeThreshold

    public final int getOldAgeThreshold()

  Specified by:
    `getOldAgeThreshold` in interface `Population`
  Returns:
    The age at which to consider a genome "old".

### getPopulationSize

    public final int getPopulationSize()

  Specified by:
    `getPopulationSize` in interface `Population`
  Returns:
    The max population size.

### getSpecies

    public final List<Species> getSpecies()

  Specified by:
    `getSpecies` in interface `Population`
  Returns:
    A list of species.

### getSpeciesIDGenerate

    public final GenerateID getSpeciesIDGenerate()

  Returns:
    the speciesIDGenerate

### getSurvivalRate

    public final double getSurvivalRate()

  Specified by:
    `getSurvivalRate` in interface `Population`
  Returns:
    The survival rate.

### getYoungBonusAgeThreshold

    public final int getYoungBonusAgeThreshold()

  Specified by:
    `getYoungBonusAgeThreshold` in interface `Population`
  Returns:
    The age, below which, a genome is considered "young".

### getYoungScoreBonus

    public final double getYoungScoreBonus()

  Specified by:
    `getYoungScoreBonus` in interface `Population`
  Returns:
    The bonus given to "young" genomes.

### setInnovations

    public final void setInnovations(InnovationList theInnovations)

  Set the innovations collection.

  Specified by:
    `setInnovations` in interface `Population`
  Parameters:
    `theInnovations` - The innovations collection.

### setName

    public final void setName(String theName)

  Set the name.

  Parameters:
    `theName` - The new name.

### setOldAgePenalty

    public final void setOldAgePenalty(double theOldAgePenalty)

  Set the old age penalty.

  Specified by:
    `setOldAgePenalty` in interface `Population`
  Parameters:
    `theOldAgePenalty` - The old age penalty.

### setOldAgeThreshold

    public final void setOldAgeThreshold(int theOldAgeThreshold)

  Set the age at which a genome is considered "old".

  Specified by:
    `setOldAgeThreshold` in interface `Population`
  Parameters:
    `theOldAgeThreshold` - The old age threshold.

### setPopulationSize

    public final void setPopulationSize(int thePopulationSize)

  Set the max population size.

  Specified by:
    `setPopulationSize` in interface `Population`
  Parameters:
    `thePopulationSize` - The max population size.

### setSurvivalRate

    public final void setSurvivalRate(double theSurvivalRate)

  Set the survival rate.

  Specified by:
    `setSurvivalRate` in interface `Population`
  Parameters:
    `theSurvivalRate` - The survival rate.

### setYoungBonusAgeThreshhold

    public final void setYoungBonusAgeThreshhold(int theYoungBonusAgeThreshold)

  Set the age at which genoms are considered young.

  Specified by:
    `setYoungBonusAgeThreshhold` in interface `Population`
  Parameters:
    `theYoungBonusAgeThreshold` - The age.

### setYoungBonusAgeThreshold

    public final void setYoungBonusAgeThreshold(int theYoungBonusAgeThreshold)

  Parameters:
    `theYoungBonusAgeThreshold` - the youngBonusAgeThreshold to set

### setYoungScoreBonus

    public final void setYoungScoreBonus(double theYoungScoreBonus)

  Set the youth score bonus.

  Specified by:
    `setYoungScoreBonus` in interface `Population`
  Parameters:
    `theYoungScoreBonus` - The bonus.

### size

    public final int size()

  Specified by:
    `size` in interface `Population`
  Returns:
    The size of the population.

### sort

    public final void sort()

  Sort the population by best score.

  Specified by:
    `sort` in interface `Population`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.