|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.udc.gii.common.eaf.algorithm.population.Individual
es.udc.gii.common.eaf.algorithm.population.MaIndividual
public class MaIndividual
This class represents an individual for a macroevolutionary algorithm.
Field Summary | |
---|---|
private double |
bestFitness
|
private static long |
serialVersionUID
|
private boolean |
survivor
|
Constructor Summary | |
---|---|
MaIndividual()
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones the current individual. |
void |
copyEvalResults(Individual other)
Copies the evaluation results of this individual to the passed individual. |
void |
generate()
Generates the chromosomes of the Individual with values in [-1.0,1.0] |
double |
getBestFitness()
|
boolean |
isSurvivor()
|
void |
readExternal(java.io.ObjectInput in)
This method is called whenever an instance of this class has to be de-serialized. |
void |
setBestFitness(double fitness)
Sets the best fitness achived by this individual. |
void |
setComparator(FitnessComparator<Individual> comparator)
Sets the fitness comparator of this individual. |
void |
setFitness(double fitness)
Sets the fitness value of the Individual. |
void |
setSurvivor(boolean survivor)
Sets if this individual is a survivor. |
void |
writeExternal(java.io.ObjectOutput out)
This method is called whenever an instance of this class has to be serialized. |
Methods inherited from class es.udc.gii.common.eaf.algorithm.population.Individual |
---|
configure, copyGenotype, equals, getChromosomeAt, getChromosomes, getComparator, getConstraints, getDimension, getFitness, getObjectives, getViolatedConstraints, hashCode, isSerializeEvalResults, isSerializeGenotype, setChromosomeAt, setChromosomes, setConstraints, setDimension, setObjectives, setSerializeEvalResults, setSerializeGenotype, setViolatedConstraints, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private double bestFitness
private boolean survivor
Constructor Detail |
---|
public MaIndividual()
Method Detail |
---|
public java.lang.Object clone()
Individual
clone
in class Individual
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
Individual
It sets the values of Individual#getSerializeEvalResults and Individual#getSerializeGenotype accordingly to the information received so that subclasses can rely on them to know what kind of information is to be read.
Subclasses should override this method if they introduce new attibutes.
Remember to call super.readExternal()
in order to
be sure that the state of the parent class is de-serialized and the values
of Individual#getSerializeEvalResults and Individual#getSerializeGenotype
contain the right information.
readExternal
in interface java.io.Externalizable
readExternal
in class Individual
in
- - DataInput from which the bytes are read.
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Individual
It might write to the output out
the evaluation results
or the genotype information or both, deppending on the value of
Individual#getSerializeEvalResults and Individual#getSerializeGenotype,
which are always writen at the beginning of the output to know later what
type of information is contained in the data.
Subclasses should override this method if they introduce new attibutes.
Remember to call super.writeExternal()
in order to
be sure that the state of the parent class is serialized.
writeExternal
in interface java.io.Externalizable
writeExternal
in class Individual
out
- - DataOutput to write the serialized bytes to.
java.io.IOException
public void setFitness(double fitness)
Individual
setFitness
in class Individual
fitness
- the new fitness value of the Individual.public double getBestFitness()
public void setBestFitness(double fitness)
fitness
- The new best fitness.public boolean isSurvivor()
true
if this individual is a survivor.
false
otherwise.public void setSurvivor(boolean survivor)
survivor
- true
if this individual is a survivor.
false
otherwise.public void generate()
Individual
generate
in class Individual
public void setComparator(FitnessComparator<Individual> comparator)
Individual
setComparator
in class Individual
comparator
- the fitness comparator of this individual.public void copyEvalResults(Individual other)
Individual
Subclasses of
Individual have to override this method and call
super.copyEvalResults()
in order to handle the copy of the
possible extra attibutes introduced in the subclass.
copyEvalResults
in class Individual
other
- - The individual into which the phenotype of this object will
be copied.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |