org.jscience.architecture.traffic.algorithms.tlc
Class ACGJ5.Population

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

protected class ACGJ5.Population
extends java.lang.Object
implements XMLSerializable

DOCUMENT ME!


Field Summary
protected  ACGJ5.Individual[] inds
          The Individuals in this population
protected  int this_gen
          a counter for the current generation of Individuals
protected  int this_ind
          the ID of the current Individual that's showing off it's coolness
 
Constructor Summary
protected ACGJ5.Population()
          Creates a new Population object.
protected ACGJ5.Population(Infrastructure infra)
          Creates a new population of Individuals
 
Method Summary
protected  float calcFitness(ACGJ5.Individual ind)
          Calculates the fitness of this Individual
protected  void evolve()
          Evolves the current generation of Individuals in the Population into a new one.
protected  int getCurrentGenerationNum()
          DOCUMENT ME!
protected  ACGJ5.Individual getIndividual()
          DOCUMENT ME!
protected  float[] getNewGenes(ACGJ5.Individual ma, ACGJ5.Individual pa)
          Returns some reproduction genes from this ACGJ3Individual.
protected  ACGJ5.Individual getNextIndividual(int wait, int move)
          DOCUMENT ME!
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
protected  ACGJ5.Individual[] mate(ACGJ5.Individual ma, ACGJ5.Individual pa)
          Mates two Individuals creating two new Individuals
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setParentName(java.lang.String parentName_)
          DOCUMENT ME!
protected  ACGJ5.Individual[] sortIndsArr(ACGJ5.Individual[] 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

this_ind

protected int this_ind
the ID of 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 ACGJ5.Individual[] inds
The Individuals in this population

Constructor Detail

ACGJ5.Population

protected ACGJ5.Population(Infrastructure infra)
Creates a new population of Individuals

Parameters:
infra - The Infrastructure the population will run on

ACGJ5.Population

protected ACGJ5.Population()
Creates a new Population object.

Method Detail

getCurrentGenerationNum

protected int getCurrentGenerationNum()
DOCUMENT ME!

Returns:
the number of the current generation of individuals

getIndividual

protected ACGJ5.Individual getIndividual()
DOCUMENT ME!

Returns:
the current individual

getNextIndividual

protected ACGJ5.Individual 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 ACGJ5.Individual[] sortIndsArr(ACGJ5.Individual[] 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(ACGJ5.Individual 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 ACGJ5.Individual[] mate(ACGJ5.Individual ma,
                                  ACGJ5.Individual pa)
Mates two Individuals creating two new Individuals

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

evolve

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


getNewGenes

protected float[] getNewGenes(ACGJ5.Individual ma,
                              ACGJ5.Individual pa)
Returns some reproduction genes from this ACGJ3Individual.

Parameters:
ma - DOCUMENT ME!
pa - DOCUMENT ME!
Returns:
DOCUMENT ME!

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!