public class BestSelection extends SelectionMethod
The tournament size can be any floating point value >= 1.0. If it is a non- integer value x then either a tournament of size ceil(x) is used (with probability x - floor(x)), else a tournament of size floor(x) is used.
Typical Number of Individuals Produced Per produce(...) call
Always 1.
Parameters
base.pick-worst bool = true or false (default) |
(should we pick from among the worst n individuals in the tournament instead of the best n?) |
base.size double >= 1 |
(the tournament size) |
base.n int > 0 |
(the number of best-individuals to select from) |
base.n-fraction 0.0 <= double < 1.0 (default is 1) |
(the number of best-individuals to select from, as a fraction of the total population) |
Default Base
select.best
Modifier and Type | Field and Description |
---|---|
int |
bestn |
double |
bestnFrac |
static int |
NOT_SET |
static String |
P_BEST
Default base
|
static String |
P_N |
static String |
P_N_FRACTION |
static String |
P_PICKWORST |
static String |
P_SIZE |
boolean |
pickWorst
Do we pick the worst instead of the best?
|
double |
probabilityOfPickingSizePlusOne
Probablity of picking the size plus one.
|
int |
size
Base size of the tournament; this may change.
|
int[] |
sortedPop
Sorted, normalized, totalized fitnesses for the population
|
INDS_PRODUCED, KEY_PARENTS
NO_PROBABILITY, P_PROB, probability
Constructor and Description |
---|
BestSelection() |
Modifier and Type | Method and Description |
---|---|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
void |
finishProducing(EvolutionState s,
int subpopulation,
int thread)
A default version of finishProducing, which does nothing.
|
(package private) int |
getTournamentSizeToUse(MersenneTwisterFast random)
Returns a tournament size to use, at random, based on base size and probability of picking the size plus one.
|
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.
|
produce, produces, produceWithoutCloning, typicalIndsProduced
clone, fillStubs, getProbability, pickRandom, preparePipeline, setProbability, setupProbabilities
public static final String P_BEST
public static final String P_N
public static final String P_N_FRACTION
public static final String P_PICKWORST
public static final String P_SIZE
public int size
public double probabilityOfPickingSizePlusOne
public boolean pickWorst
public int[] sortedPop
public static final int NOT_SET
public int bestn
public double bestnFrac
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
int getTournamentSizeToUse(MersenneTwisterFast random)
public int produce(int subpopulation, EvolutionState state, int thread)
SelectionMethod
produce
in class SelectionMethod
public void finishProducing(EvolutionState s, int subpopulation, int thread)
SelectionMethod
finishProducing
in class SelectionMethod
Copyright © 2019. All rights reserved.