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

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

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

DOCUMENT ME!


Field Summary
protected  byte[] bytema
          The Chromosomes as gotten from mama
protected  byte[] bytepa
          DOCUMENT ME!
protected  float fitness
          DOCUMENT ME!
protected  float[][][] me
          The array of float values that describe this ACGJ3Individual.
protected  int move
          DOCUMENT ME!
protected  java.lang.String myParentName
          DOCUMENT ME!
protected  int wait
          DOCUMENT ME!
 
Constructor Summary
protected ACGJ3.ACGJ3Individual()
          Constructor for loading
protected ACGJ3.ACGJ3Individual(byte[] ma, byte[] pa)
          Creates a new ACGJ3Individual, providing the reproduction genes from daddy and mummy
protected ACGJ3.ACGJ3Individual(Infrastructure infra)
          Creates a new ACGJ3Individual, providing the Infrastructure it should run on
 
Method Summary
protected  void createMe()
          DOCUMENT ME!
protected  float getFitness()
          Returns the fitness of the current Individual, as was set at iterating through this generation
protected  byte[][] getGenes()
          Returns the genes of this ACGJ3Individual
protected  int getMove()
          Returns the amount of Roadusers that did move during this Individuals lifespan
protected  float getQValue(int node, int tl)
          Calculates the current gain of the given TrafficLight
protected  byte[] getReproGenes(float cross, float mutate)
          Returns some reproduction genes from this ACGJ3Individual.
protected  int getWait()
          returns the number of Roadusers this Individual caused to wait
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
protected  void relaxBucket(int node, TrafficLight tl)
          Empties the 'gain-value' bucket partly, which is being filled when Roadusers are waiting/voting for their TrafficLight to be set to green.
protected  void reset()
          Resets the buckets and waiting values for this Individual
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
protected  void setFitness(float fit)
          Sets the fitness of this Individual
protected  void setMove(int _move)
          Sets the amount of Roadusers that did move during this Individual's lifespan
 void setParentName(java.lang.String parentName)
          DOCUMENT ME!
protected  void setWait(int _wait)
          Sets the number of cars that this Individual caused to wait
protected  void siphonToOtherBucket(TrafficLight here, TrafficLight there)
          When a Roaduser may drive according to it's Sign, but cant as the desired Drivelane is full, (some/all) of the current gain-bucket of it's current TrafficLight is siphoned over to the desired Drivelane, making it more probable that that lane will move, making it possible for this Drivelane to move.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytema

protected byte[] bytema
The Chromosomes as gotten from mama


bytepa

protected byte[] bytepa
DOCUMENT ME!


me

protected float[][][] me
The array of float values that describe this ACGJ3Individual. Hence the name of the array. Encoded are for every TrafficLight in the Infrastructure: a float value 'weight per waiting roaduser' a float value 'degrading/increasement weight per Roaduser waiting further up the Queue' a float value 'gain-bucket' in which all the weights of waiting Roadusers are collected a float value 'number of Roadusers waiting' which is needed to make decreasement of the gain-bucket possible


wait

protected int wait
DOCUMENT ME!


move

protected int move
DOCUMENT ME!


fitness

protected float fitness
DOCUMENT ME!


myParentName

protected java.lang.String myParentName
DOCUMENT ME!

Constructor Detail

ACGJ3.ACGJ3Individual

protected ACGJ3.ACGJ3Individual(Infrastructure infra)
Creates a new ACGJ3Individual, providing the Infrastructure it should run on

Parameters:
infra - DOCUMENT ME!

ACGJ3.ACGJ3Individual

protected ACGJ3.ACGJ3Individual(byte[] ma,
                                byte[] pa)
Creates a new ACGJ3Individual, providing the reproduction genes from daddy and mummy

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

ACGJ3.ACGJ3Individual

protected ACGJ3.ACGJ3Individual()
Constructor for loading

Method Detail

createMe

protected void createMe()
DOCUMENT ME!


reset

protected void reset()
Resets the buckets and waiting values for this Individual


getGenes

protected byte[][] getGenes()
Returns the genes of this ACGJ3Individual

Returns:
DOCUMENT ME!

getReproGenes

protected byte[] getReproGenes(float cross,
                               float mutate)
Returns some reproduction genes from this ACGJ3Individual.

Parameters:
cross - DOCUMENT ME!
mutate - DOCUMENT ME!
Returns:
DOCUMENT ME!

getFitness

protected float getFitness()
Returns the fitness of the current Individual, as was set at iterating through this generation

Returns:
DOCUMENT ME!

setFitness

protected void setFitness(float fit)
Sets the fitness of this Individual

Parameters:
fit -

setWait

protected void setWait(int _wait)
Sets the number of cars that this Individual caused to wait

Parameters:
_wait -

getWait

protected int getWait()
returns the number of Roadusers this Individual caused to wait

Returns:
DOCUMENT ME!

setMove

protected void setMove(int _move)
Sets the amount of Roadusers that did move during this Individual's lifespan

Parameters:
_move -

getMove

protected int getMove()
Returns the amount of Roadusers that did move during this Individuals lifespan

Returns:
DOCUMENT ME!

getQValue

protected float getQValue(int node,
                          int tl)
Calculates the current gain of the given TrafficLight

Parameters:
node - the Id of the Node this TrafficLight belongs to
tl - The position of the TrafficLight in the TLDecision[][]
Returns:
the gain-value of when this TrafficLight is set to green

relaxBucket

protected void relaxBucket(int node,
                           TrafficLight tl)
Empties the 'gain-value' bucket partly, which is being filled when Roadusers are waiting/voting for their TrafficLight to be set to green.

Parameters:
node - The Id of the Node of which a bucket has to be emptied a bit
tl - The TrafficLight of which a bucket has to be partly emptied in the TLDecision[][]

siphonToOtherBucket

protected void siphonToOtherBucket(TrafficLight here,
                                   TrafficLight there)
When a Roaduser may drive according to it's Sign, but cant as the desired Drivelane is full, (some/all) of the current gain-bucket of it's current TrafficLight is siphoned over to the desired Drivelane, making it more probable that that lane will move, making it possible for this Drivelane to move.

Parameters:
here - the Id of the Node at which the Roaduser is waiting
there - The TrafficLight the Roaduser is waiting for

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!