public class MultiSelection extends SelectionMethod
Typical Number of Individuals Produced Per produce(...) call
Always 1.
Parameters
base.num-selects int >= 1 |
(The number of subordinate SelectionMethods) |
base.select.n classname, inherits and != SelectionMethod | (Subordinate SelectionMethod n) |
Default Base
select.multiselect
Parameter bases
base.select.n | Subordinate SelectionMethod n |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
P_MULTISELECT |
static java.lang.String |
P_NUMSELECTS |
static java.lang.String |
P_SELECT |
SelectionMethod[] |
selects
The MultiSelection's individuals
|
INDS_PRODUCED
NO_PROBABILITY, P_PROB, probability
Constructor and Description |
---|
MultiSelection() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a new individual cloned from a prototype,
and suitable to begin use in its own evolutionary
context.
|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
void |
preparePipeline(java.lang.Object hook)
A hook which should be passed to all your subsidiary breeding
sources.
|
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.
|
int |
produce(int min,
int max,
int start,
int subpopulation,
Individual[] inds,
EvolutionState state,
int thread)
Produces n individuals from the given subpopulation
and puts them into inds[start...start+n-1],
where n = Min(Max(q,min),max), where q is the "typical" number of
individuals the BreedingSource produces in one shot, and returns
n.
|
boolean |
produces(EvolutionState state,
Population newpop,
int subpopulation,
int thread)
A default version of produces -- this method always returns
true under the assumption that the selection method works
with all Fitnesses.
|
void |
setup(EvolutionState state,
Parameter base)
Sets up the BreedingPipeline.
|
finishProducing, typicalIndsProduced
getProbability, pickRandom, setProbability, setupProbabilities
public static final java.lang.String P_NUMSELECTS
public static final java.lang.String P_SELECT
public static final java.lang.String P_MULTISELECT
public SelectionMethod[] selects
public Parameter defaultBase()
Prototype
public java.lang.Object clone()
Prototype
Typically this should be a full "deep" clone. However, you may share certain elements with other objects rather than clone hem, depending on the situation:
Implementations.
public Object clone()
{
try
{
return super.clone();
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
}
public Object clone()
{
try
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
}
catch ((CloneNotSupportedException e)
{ throw new InternalError(); } // never happens
return myobj;
}
public Object clone()
{
MyObject myobj = (MyObject) (super.clone());
// put your deep-cloning code here...
return myobj;
}
clone
in interface Prototype
clone
in class BreedingSource
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 boolean produces(EvolutionState state, Population newpop, int subpopulation, int thread)
SelectionMethod
produces
in class SelectionMethod
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
public int produce(int min, int max, int start, int subpopulation, Individual[] inds, EvolutionState state, int thread)
BreedingSource
produce
in class SelectionMethod
public void preparePipeline(java.lang.Object hook)
BreedingSource
ECJ at present does not custom-implement or call this method: it's available for you. Becuase it has custom functionality, this method might get called more than once, and by various objects as needed. If you use it, you should determine somehow how to use it to send information under the assumption that it might be sent by nested items in the pipeline; you don't want to scribble over each other's calls! Note that this method should travel *all* breeding source paths regardless of whether or not it's redundant to do so.
preparePipeline
in class BreedingSource