|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.jgap.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.
| Constructor Summary | |
WeightedRouletteSelector()
|
|
| Method Summary | |
void |
add(org.jgap.Chromosome chromosome,
int fitness)
Add a Chromosome instance and corresponding fitness value to this selector's working pool of Chromosomes. |
void |
empty()
Empty out the working pool of Chromosomes. |
org.jgap.Chromosome[] |
select(int howMany)
Select a given number of Chromosomes from the pool that will continue to survive. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WeightedRouletteSelector()
| Method Detail |
public void add(org.jgap.Chromosome chromosome,
int fitness)
NaturalSelector
add in interface NaturalSelectorpublic org.jgap.Chromosome[] select(int howMany)
NaturalSelector
select in interface NaturalSelectorpublic void empty()
NaturalSelector
empty in interface NaturalSelector
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||