|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.NaturalSelector
org.jgap.impl.WeightedRouletteSelector
public class WeightedRouletteSelector
A basic implementation of NaturalSelector that models a roulette wheel. When a Chromosome is added, it gets a number of "slots" on the wheel equal to its fitness value. When the select method is invoked, the wheel is "spun" and the Chromosome occupying the spot on which it lands is selected. Then the wheel is spun again and again until the requested number of Chromosomes have been selected. Since Chromosomes with higher fitness values get more slots on the wheel, there's a higher statistical probability that they'll be chosen, but it's not guaranteed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jgap.NaturalSelector |
|---|
NaturalSelector.FitnessValueComparator |
| Constructor Summary | |
|---|---|
WeightedRouletteSelector()
Default constructor. |
|
WeightedRouletteSelector(Configuration a_config)
|
|
| Method Summary | |
|---|---|
protected void |
add(IChromosome a_chromosomeToAdd)
Add a Chromosome instance to this selector's working pool of Chromosomes. |
void |
empty()
Empty out the working pool of Chromosomes. |
boolean |
getDoubletteChromosomesAllowed()
|
boolean |
returnsUniqueChromosomes()
|
void |
select(int a_howManyToSelect,
Population a_from_pop,
Population a_to_pop)
Select a given number of Chromosomes from the pool that will move on to the next generation population. |
void |
setDoubletteChromosomesAllowed(boolean a_doublettesAllowed)
Determines whether doublette chromosomes may be added to the selector or will be ignored. |
| Methods inherited from class org.jgap.NaturalSelector |
|---|
getConfiguration |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WeightedRouletteSelector()
Attention: The configuration used is the one set with the static method Genotype.setConfiguration.
public WeightedRouletteSelector(Configuration a_config)
a_config - the configuration to use| Method Detail |
|---|
protected void add(IChromosome a_chromosomeToAdd)
add in class NaturalSelectora_chromosomeToAdd - the chromosom to add to the pool
public void select(int a_howManyToSelect,
Population a_from_pop,
Population a_to_pop)
a_howManyToSelect - the number of Chromosomes to selecta_from_pop - the population the Chromosomes will be selected froma_to_pop - the population the Chromosomes will be added topublic void empty()
public boolean returnsUniqueChromosomes()
public void setDoubletteChromosomesAllowed(boolean a_doublettesAllowed)
a_doublettesAllowed - true: doublette chromosomes allowed to be
added to the selector. FALSE: doublettes will be ignored and not addedpublic boolean getDoubletteChromosomesAllowed()
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||