public abstract class Species extends java.lang.Object implements Prototype
Species are generally responsible for creating individuals, through their newIndividual(...) method. This method usually clones its prototypical individual and makes some additional modifications to the clone, then returns it. Note that the prototypical individual does not need to be a complete individual -- for example, GPSpecies holds a GPIndividual which doesn't have any trees (the tree roots are null).
Species also holds a prototypical breeding pipeline meant to breed this individual. To breed individuals of this species, clone the pipeline and use the clone.
Parameters
base.ind classname, inherits and != ec.Individual |
(the class for the prototypical individual for the species) |
base.fitness classname, inherits and != ec.Fitness |
(the class for the prototypical fitness for the species) |
base.numpipes int >= 1 |
(total number of breeding pipelines for the species) |
base.pipe classname, inherits and != ec.BreedingSource |
(the class for the prototypical Breeding Source) |
Parameter bases
base.ind | i_prototype (the prototypical individual) |
base.pipe | pipe_prototype (breeding source prototype) |
base.fitness | f_prototype (the prototypical fitness) |
Modifier and Type | Field and Description |
---|---|
Fitness |
f_prototype
The prototypical fitness for individuals of this species.
|
Individual |
i_prototype
The prototypical individual for this species.
|
static java.lang.String |
P_FITNESS |
static java.lang.String |
P_INDIVIDUAL |
static java.lang.String |
P_PIPE |
BreedingSource |
pipe_prototype
The prototypical breeding pipeline for this species.
|
Constructor and Description |
---|
Species() |
Modifier and Type | Method and Description |
---|---|
java.util.HashMap<java.lang.String,java.lang.Object> |
buildMisc(EvolutionState state,
int subpopIndex,
int thread)
Called whenever the Breeder calls produce(...) on a BreedingPipeline, in order to pass
a new "misc" object.
|
java.lang.Object |
clone()
Creates a new individual cloned from a prototype,
and suitable to begin use in its own evolutionary
context.
|
Individual |
newIndividual(EvolutionState state,
java.io.DataInput dataInput)
Provides an individual read from a DataInput source, including
the fitness.
|
Individual |
newIndividual(EvolutionState state,
int thread)
Provides a brand-new individual to fill in a population.
|
Individual |
newIndividual(EvolutionState state,
java.io.LineNumberReader reader)
Provides an individual read from a stream, including
the fitness; the individual will
appear as it was written by printIndividual(...).
|
void |
setup(EvolutionState state,
Parameter base)
The default version of setup(...) loads requested pipelines and calls setup(...) on them and normalizes their probabilities.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
defaultBase
public static final java.lang.String P_INDIVIDUAL
public static final java.lang.String P_PIPE
public static final java.lang.String P_FITNESS
public Individual i_prototype
public BreedingSource pipe_prototype
public Fitness f_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;
}
public java.util.HashMap<java.lang.String,java.lang.Object> buildMisc(EvolutionState state, int subpopIndex, int thread)
public Individual newIndividual(EvolutionState state, int thread)
public Individual newIndividual(EvolutionState state, java.io.LineNumberReader reader) throws java.io.IOException
java.io.IOException
public Individual newIndividual(EvolutionState state, java.io.DataInput dataInput) throws java.io.IOException
java.io.IOException
public void setup(EvolutionState state, Parameter base)
setup
in interface Prototype
setup
in interface Setup
Prototype.setup(EvolutionState,Parameter)