jaga.evolve
Class RankSelector
java.lang.Object
|
+--jaga.evolve.RankSelector
- All Implemented Interfaces:
- Selector, java.io.Serializable
- public class RankSelector
- extends java.lang.Object
- implements Selector
A Rank selector. Must be used with fixed size populations.
- See Also:
- Serialized Form
Constructor Summary |
RankSelector()
Creates new RankSelector where the rank table will be so that the
worst individual gets 0 chance of selection and the highest gets the
double of the median. |
RankSelector(double[] rankTable)
Creates new RankSelector using custom rankTable. |
Method Summary |
void |
refresh()
can be used to refresh the internal state in the case for example
that the population changed. |
Genotype |
select(Population pop)
Picks a genotype from the population through some selection process. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RankSelector
public RankSelector()
- Creates new RankSelector where the rank table will be so that the
worst individual gets 0 chance of selection and the highest gets the
double of the median.
RankSelector
public RankSelector(double[] rankTable)
- Creates new RankSelector using custom rankTable. If the table is too
short, unmentioned elements won't be reproduced. First element refers
to fittest and so forth in descending order.
select
public Genotype select(Population pop)
- Picks a genotype from the population through some selection process.
- Specified by:
select
in interface Selector
refresh
public void refresh()
- can be used to refresh the internal state in the case for example
that the population changed. This allows a selector to be optimized
for a certain population by keeping state of it from one call to another
In this case:
1. Sorts the population into ascending order.
2. Creates the rank table if needed.
- Specified by:
refresh
in interface Selector
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object