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 String |
P_MULTISELECT |
static String |
P_NUMSELECTS |
static String |
P_SELECT |
SelectionMethod[] |
selects
The MultiSelection's individuals
|
private static long |
serialVersionUID |
INDS_PRODUCEDNO_PROBABILITY, P_PROB, probability| Constructor and Description |
|---|
MultiSelection() |
| Modifier and Type | Method and Description |
|---|---|
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(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, typicalIndsProducedgetProbability, pickRandom, setProbability, setupProbabilitiesprivate static final long serialVersionUID
public static final String P_NUMSELECTS
public static final String P_SELECT
public static final String P_MULTISELECT
public SelectionMethod[] selects
public Parameter defaultBase()
Prototypepublic Object clone()
PrototypeTypically 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 Prototypeclone in class BreedingSourcepublic void setup(EvolutionState state, Parameter base)
BreedingSourceThe 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 Prototypesetup in interface Setupsetup in class BreedingSourcePrototype.setup(EvolutionState,Parameter)public boolean produces(EvolutionState state, Population newpop, int subpopulation, int thread)
SelectionMethodproduces in class SelectionMethodpublic void prepareToProduce(EvolutionState s, int subpopulation, int thread)
SelectionMethodprepareToProduce in class SelectionMethodpublic int produce(int subpopulation,
EvolutionState state,
int thread)
SelectionMethodproduce in class SelectionMethodpublic int produce(int min,
int max,
int start,
int subpopulation,
Individual[] inds,
EvolutionState state,
int thread)
BreedingSourceproduce in class SelectionMethodpublic void preparePipeline(Object hook)
BreedingSourceECJ 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 BreedingSourceCopyright © 2014 Evolutionary Computation Laboratory at George Mason University. All rights reserved.