org.jscience.architecture.traffic.algorithms.tlc
Class ACGJ3.ACGJ3Population

java.lang.Object
  extended by org.jscience.architecture.traffic.algorithms.tlc.ACGJ3.ACGJ3Population
All Implemented Interfaces:
XMLSerializable
Enclosing class:
ACGJ3

protected class ACGJ3.ACGJ3Population
extends java.lang.Object
implements XMLSerializable

DOCUMENT ME!


Field Summary
protected  float crossover
          the chance that crossover occurs at evolving.
protected  ACGJ3.ACGJ3Individual[] inds
          DOCUMENT ME!
protected  float mutate
          the chance that mutation occurs when evolving.
protected  int num_gen
          the total amount of generations this population should evolve over
protected  int num_ind
          the current number of individuals in this population
protected  int this_gen
          a counter for the current generation of Individuals
protected  int this_ind
          the current Individual that's showing off it's coolness
 
Constructor Summary
protected ACGJ3.ACGJ3Population()
          Creates a new ACGJ3Population object.
protected ACGJ3.ACGJ3Population(Infrastructure infra, int _num_ind, int _num_gen, float cross, float mut)
          Creates a new population of ACGJ3Individuals
 
Method Summary
protected  float calcFitness(ACGJ3.ACGJ3Individual ind)
          Calculates the fitness of this Individual
protected  void evolve()
          Evolves the current generation of ACGJ3Individuals in the ACGJ3Population into a new one.
protected  int getCurrentGenerationNum()
          DOCUMENT ME!
protected  ACGJ3.ACGJ3Individual getIndividual()
          DOCUMENT ME!
protected  ACGJ3.ACGJ3Individual getNextIndividual(int wait, int move)
          DOCUMENT ME!
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
protected  ACGJ3.ACGJ3Individual[] mate(ACGJ3.ACGJ3Individual ma, ACGJ3.ACGJ3Individual pa)
          Mates two ACGJ3Individuals creating two new ACGJ3Individuals
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setParentName(java.lang.String parentName_)
          DOCUMENT ME!
protected  ACGJ3.ACGJ3Individual[] sortIndsArr(ACGJ3.ACGJ3Individual[] ar)
          BubbleSorts an array of ACGJ3Individuals on the parameter of performance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mutate

protected float mutate
the chance that mutation occurs when evolving. Set via Constructor of ACGJ3Population


crossover

protected float crossover
the chance that crossover occurs at evolving.


num_ind

protected int num_ind
the current number of individuals in this population


num_gen

protected int num_gen
the total amount of generations this population should evolve over


this_ind

protected int this_ind
the current Individual that's showing off it's coolness


this_gen

protected int this_gen
a counter for the current generation of Individuals


inds

protected ACGJ3.ACGJ3Individual[] inds
DOCUMENT ME!

Constructor Detail

ACGJ3.ACGJ3Population

protected ACGJ3.ACGJ3Population(Infrastructure infra,
                                int _num_ind,
                                int _num_gen,
                                float cross,
                                float mut)
Creates a new population of ACGJ3Individuals

Parameters:
infra - The Infrastructure the population will run on
_num_ind - the number of individuals in the population
_num_gen - the number of generations there should be evolved over
cross - the chance that crossover occurs at reproduction
mut - the chance that mutation occurs at reproduction

ACGJ3.ACGJ3Population

protected ACGJ3.ACGJ3Population()
Creates a new ACGJ3Population object.

Method Detail

getCurrentGenerationNum

protected int getCurrentGenerationNum()
DOCUMENT ME!

Returns:
the number of the current generation of individuals

getIndividual

protected ACGJ3.ACGJ3Individual getIndividual()
DOCUMENT ME!

Returns:
the current individual

getNextIndividual

protected ACGJ3.ACGJ3Individual getNextIndividual(int wait,
                                                  int move)
DOCUMENT ME!

Parameters:
wait - The performance of the current Individual
move - DOCUMENT ME!
Returns:
the next ACGJ3Individual. Either one of this generation, or if all individuals in this generation have been used, it evolves into a new generation and returns a new Individual from that generation.

sortIndsArr

protected ACGJ3.ACGJ3Individual[] sortIndsArr(ACGJ3.ACGJ3Individual[] ar)
BubbleSorts an array of ACGJ3Individuals on the parameter of performance

Parameters:
ar - the array to be sorted
Returns:
the sorted array

calcFitness

protected float calcFitness(ACGJ3.ACGJ3Individual ind)
Calculates the fitness of this Individual

Parameters:
ind - the individual of which the fitness has to be calculated
Returns:
the fitness of this individual

mate

protected ACGJ3.ACGJ3Individual[] mate(ACGJ3.ACGJ3Individual ma,
                                       ACGJ3.ACGJ3Individual pa)
Mates two ACGJ3Individuals creating two new ACGJ3Individuals

Parameters:
ma - The mamma-ACGJ3Individual
pa - The pappa-ACGJ3Individual
Returns:
an array of length 2 of two newborn ACGJ3Individuals

evolve

protected void evolve()
Evolves the current generation of ACGJ3Individuals in the ACGJ3Population into a new one.


load

public void load(XMLElement myElement,
                 XMLLoader loader)
          throws XMLTreeException,
                 java.io.IOException,
                 XMLInvalidInputException
DOCUMENT ME!

Specified by:
load in interface XMLSerializable
Parameters:
myElement - DOCUMENT ME!
loader - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!

saveSelf

public XMLElement saveSelf()
                    throws XMLCannotSaveException
DOCUMENT ME!

Specified by:
saveSelf in interface XMLSerializable
Returns:
DOCUMENT ME!
Throws:
XMLCannotSaveException - DOCUMENT ME!

saveChilds

public void saveChilds(XMLSaver saver)
                throws XMLTreeException,
                       java.io.IOException,
                       XMLCannotSaveException
DOCUMENT ME!

Specified by:
saveChilds in interface XMLSerializable
Parameters:
saver - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!

getXMLName

public java.lang.String getXMLName()
DOCUMENT ME!

Specified by:
getXMLName in interface XMLSerializable
Returns:
DOCUMENT ME!

setParentName

public void setParentName(java.lang.String parentName_)
                   throws XMLTreeException
DOCUMENT ME!

Specified by:
setParentName in interface XMLSerializable
Parameters:
parentName_ - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!