|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectec.BreedingSource
ec.SelectionMethod
ec.select.SUSSelection
public class SUSSelection
Picks individuals in a population using the Stochastic Universal Selection (SUS) process, using fitnesses as returned by their fitness() methods. This is expensive to set up and bring down, so it's not appropriate for steady-state evolution. If you're not familiar with the relative advantages of selection methods and just want a good one, use TournamentSelection instead. Not appropriate for multiobjective fitnesses.
By default this implementation of SUS shuffles the order of the individuals in the distribution before performing selection. This isn't always present in classic implementations of the algorithm but it can't hurt anything and certainly can avoid certain pathological situations. If you'd prefer not to preshuffle, set shuffle=false Note that we don't actually change the order of the individuals in the population -- instead we maintain our own internal array of indices and shuffle that.
Like truncation selection, SUS samples N individuals (with replacement) up front from the population, Then returns those individuals one by one. ECJ's implementation assumes that N is the size of the population -- that is, you're going to ultimately request a whole population out of this one selection method. This could be a false assumption: for example, if you only sometimes call this selection method, and sometimes TournamentSelection; or if you've got multiple pipelines. In these cases, SUS is probably a bad choice anyway.
If you ask for more than a population's worth of individuals, SUS tries to handle this gracefully by reshuffling its array and starting to select over again. But again that might suggest you are doing something wrong.
Note: Fitnesses must be non-negative. 0 is assumed to be the worst fitness.
Typical Number of Individuals Produced Per produce(...) call
Always 1.
Parameters
base.shuffle bool = true (default) or false |
(should we preshuffle the array before doing selection?) |
Default Base
select.sus
Field Summary | |
---|---|
float[] |
fitnesses
The distribution of fitnesses. |
int[] |
indices
An array of pointers to individuals in the population, shuffled along with the fitnesses array. |
int |
lastIndex
The index in the array of the last individual selected. |
float |
offset
The floating point value to consider for the next selected individual. |
static java.lang.String |
P_SHUFFLE
|
static java.lang.String |
P_SUS
Default base |
boolean |
shuffle
Should we shuffle first? |
int |
steps
How many samples have been done? |
Fields inherited from class ec.SelectionMethod |
---|
INDS_PRODUCED |
Fields inherited from class ec.BreedingSource |
---|
NO_PROBABILITY, P_PROB, probability |
Constructor Summary | |
---|---|
SUSSelection()
|
Method Summary | |
---|---|
Parameter |
defaultBase()
Returns the default base for this prototype. |
void |
prepareToProduce(EvolutionState s,
int subpopulation,
int thread)
A default version of prepareToProduce which does nothing. |
int |
produce(int subpopulation,
EvolutionState state,
int thread)
An alternative form of "produce" special to Selection Methods; selects an individual from the given subpopulation and returns its position in that subpopulation. |
void |
setup(EvolutionState state,
Parameter base)
Sets up the BreedingPipeline. |
Methods inherited from class ec.SelectionMethod |
---|
finishProducing, produce, produces, typicalIndsProduced |
Methods inherited from class ec.BreedingSource |
---|
clone, getProbability, pickRandom, preparePipeline, setProbability, setupProbabilities |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String P_SUS
public static final java.lang.String P_SHUFFLE
public int[] indices
public float[] fitnesses
public boolean shuffle
public float offset
public int lastIndex
public int steps
Constructor Detail |
---|
public SUSSelection()
Method Detail |
---|
public Parameter defaultBase()
Prototype
public void setup(EvolutionState state, Parameter base)
BreedingSource
The most common modification is to normalize it with some other set of probabilities, then set all of them up in increasing summation; this allows the use of the fast static BreedingSource-picking utility method, BreedingSource.pickRandom(...). In order to use this method, for example, if four breeding source probabilities are {0.3, 0.2, 0.1, 0.4}, then they should get normalized and summed by the outside owners as: {0.3, 0.5, 0.6, 1.0}.
setup
in interface Prototype
setup
in interface Setup
setup
in class BreedingSource
Prototype.setup(EvolutionState,Parameter)
public void prepareToProduce(EvolutionState s, int subpopulation, int thread)
SelectionMethod
prepareToProduce
in class SelectionMethod
public int produce(int subpopulation, EvolutionState state, int thread)
SelectionMethod
produce
in class SelectionMethod
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |