es.udc.gii.common.eaf.algorithm.population
Class MaIndividual

java.lang.Object
  extended by es.udc.gii.common.eaf.algorithm.population.Individual
      extended by es.udc.gii.common.eaf.algorithm.population.MaIndividual
All Implemented Interfaces:
Configurable, java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class MaIndividual
extends Individual

Author:
ronin
See Also:
Serialized Form

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)
           
 void setComparator(FitnessComparator<Individual> comparator)
           
 void setFitness(double fitness)
          Sets the fitness value of the Individual.
 void setSurvivor(boolean 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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

bestFitness

private double bestFitness

survivor

private boolean survivor
Constructor Detail

MaIndividual

public MaIndividual()
Method Detail

clone

public java.lang.Object clone()
Description copied from class: Individual
Clones the current individual.

Overrides:
clone in class Individual
Returns:
a new individual which is a copy of the current one.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Description copied from class: Individual
This method is called whenever an instance of this class has to be de-serialized.

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.

Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class Individual
Parameters:
in - - DataInput from which the bytes are read.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Description copied from class: Individual
This method is called whenever an instance of this class has to be serialized.

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.

Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class Individual
Parameters:
out - - DataOutput to write the serialized bytes to.
Throws:
java.io.IOException

setFitness

public void setFitness(double fitness)
Description copied from class: Individual
Sets the fitness value of the Individual.

Overrides:
setFitness in class Individual
Parameters:
fitness - the new fitness value of the Individual.

getBestFitness

public double getBestFitness()

setBestFitness

public void setBestFitness(double fitness)

isSurvivor

public boolean isSurvivor()

setSurvivor

public void setSurvivor(boolean survivor)

generate

public void generate()
Description copied from class: Individual
Generates the chromosomes of the Individual with values in [-1.0,1.0]

Overrides:
generate in class Individual

setComparator

public void setComparator(FitnessComparator<Individual> comparator)
Overrides:
setComparator in class Individual

copyEvalResults

public void copyEvalResults(Individual other)
Description copied from class: Individual
Copies the evaluation results of this individual to the passed individual. No deep copy is made, so this object and the passed individual share this information.

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.

Overrides:
copyEvalResults in class Individual
Parameters:
other - - The individual into which the phenotype of this object will be copied.