org.jscience.architecture.traffic.algorithms.tlc
Class GenNeuralTLC

java.lang.Object
  extended by org.jscience.architecture.traffic.algorithms.tlc.TLController
      extended by org.jscience.architecture.traffic.algorithms.tlc.GenNeuralTLC
All Implemented Interfaces:
InstantiationAssistant, TwoStageLoader, XMLSerializable

public class GenNeuralTLC
extends TLController
implements XMLSerializable, TwoStageLoader, InstantiationAssistant

DOCUMENT ME!


Nested Class Summary
protected  class GenNeuralTLC.GenNeuralIndividual
          DOCUMENT ME!
protected  class GenNeuralTLC.GenNeuralPopulation
          DOCUMENT ME!
 
Nested classes/interfaces inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
TLController.TLCDialog, TLController.TLCSettings
 
Field Summary
protected  InstantiationAssistant assistant
          DOCUMENT ME!
protected static float CROSSOVER_CHANCE
          A constant for the chance that genes cross over
protected  GenNeuralTLC.GenNeuralIndividual[] ind
          the current GenNeural that is running
protected  Infrastructure infra
          DOCUMENT ME!
protected static float MUTATION_CHANCE
          A constant for the chance that mutation occurs
protected  int num_move
          counter for the number of roadusers that did move
protected  int num_nodes
          the number of nodes in the current infrastructure
protected  int num_step
          counter for the number of steps the simulation has ran yet
protected static int NUM_STEPS
          A constant for the number of steps an individual may run
protected  int num_wait
          counter for how many roadusers had to wait a turn
protected static int NUMBER_GENERATIONS
          A constant for the number of generations
protected static int NUMBER_INDIVIDUALS
          A constant for the number of individuals
protected  GenNeuralTLC.GenNeuralPopulation pop
          The Population of GenNeuralIndividuals
protected  java.util.Random random
          The pseudo-random number generator for generating the chances that certain events will occur
protected static java.lang.String shortXMLName
          DOCUMENT ME!
 
Fields inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
num_tls, tld, trackNode
 
Constructor Summary
GenNeuralTLC(Infrastructure i)
          Creates a new GenNeural Algorithm.
 
Method Summary
 boolean canCreateInstance(java.lang.Class request)
          DOCUMENT ME!
 java.lang.Object createInstance(java.lang.Class request)
          DOCUMENT ME!
 TLDecision[][] decideTLs()
          Calculates how every traffic light should be switched
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
 void loadSecondStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setInfrastructure(Infrastructure i)
          Changes the Infrastructure this algorithm is working on
 void showSettings(Controller c)
          DOCUMENT ME!
 void updateRoaduserMove(Roaduser _ru, Drivelane _prevlane, Sign _prevsign, int _prevpos, Drivelane _dlanenow, Sign _signnow, int _posnow, PosMov[] posMovs, Drivelane _desired)
          Provides the TLC-algorithm with information about a roaduser that has had it's go in the moveAllRoaduser-cycle.
 
Methods inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
applyGainValues, createDecisionArray, doSettingsDialog, getGainValuesFromDecisionArray, getInfrastructure, getNumTLs, reset, setParentName, trackNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jscience.architecture.traffic.xml.XMLSerializable
setParentName
 

Field Detail

NUM_STEPS

protected static int NUM_STEPS
A constant for the number of steps an individual may run


CROSSOVER_CHANCE

protected static float CROSSOVER_CHANCE
A constant for the chance that genes cross over


MUTATION_CHANCE

protected static float MUTATION_CHANCE
A constant for the chance that mutation occurs


NUMBER_INDIVIDUALS

protected static int NUMBER_INDIVIDUALS
A constant for the number of individuals


NUMBER_GENERATIONS

protected static int NUMBER_GENERATIONS
A constant for the number of generations


shortXMLName

protected static final java.lang.String shortXMLName
DOCUMENT ME!

See Also:
Constant Field Values

num_nodes

protected int num_nodes
the number of nodes in the current infrastructure


num_step

protected int num_step
counter for the number of steps the simulation has ran yet


num_wait

protected int num_wait
counter for how many roadusers had to wait a turn


num_move

protected int num_move
counter for the number of roadusers that did move


ind

protected GenNeuralTLC.GenNeuralIndividual[] ind
the current GenNeural that is running


pop

protected GenNeuralTLC.GenNeuralPopulation pop
The Population of GenNeuralIndividuals


random

protected java.util.Random random
The pseudo-random number generator for generating the chances that certain events will occur


infra

protected Infrastructure infra
DOCUMENT ME!


assistant

protected InstantiationAssistant assistant
DOCUMENT ME!

Constructor Detail

GenNeuralTLC

public GenNeuralTLC(Infrastructure i)
Creates a new GenNeural Algorithm. This TLC-algorithm is using genetic and neural-network techniques to find an optimum in calculating the gains for each trafficlight. Till date it hasnt functioned that well. Rather poorly, to just say it.

Parameters:
i - The infrastructure this algorithm will have to operate on
Method Detail

setInfrastructure

public void setInfrastructure(Infrastructure i)
Changes the Infrastructure this algorithm is working on

Overrides:
setInfrastructure in class TLController
Parameters:
i - The new infrastructure for which the algorithm has to be set up

decideTLs

public TLDecision[][] decideTLs()
Calculates how every traffic light should be switched

Specified by:
decideTLs in class TLController
Returns:
Returns a double array of TLDecision's. These are tuples of a TrafficLight and the gain-value of when it's set to green.
See Also:
gld.algo.tlc.TLDecision

updateRoaduserMove

public void updateRoaduserMove(Roaduser _ru,
                               Drivelane _prevlane,
                               Sign _prevsign,
                               int _prevpos,
                               Drivelane _dlanenow,
                               Sign _signnow,
                               int _posnow,
                               PosMov[] posMovs,
                               Drivelane _desired)
Provides the TLC-algorithm with information about a roaduser that has had it's go in the moveAllRoaduser-cycle. From this information it can be distilled whether a roaduser has moved or had to wait.

Specified by:
updateRoaduserMove in class TLController
Parameters:
_ru -
_prevlane -
_prevsign -
_prevpos -
_dlanenow -
_signnow -
_posnow -
posMovs -
_desired -

load

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

Specified by:
load in interface XMLSerializable
Overrides:
load in class TLController
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
Overrides:
saveSelf in class TLController
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
Overrides:
saveChilds in class TLController
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!

loadSecondStage

public void loadSecondStage(java.util.Dictionary dictionaries)
                     throws XMLInvalidInputException,
                            XMLTreeException
DOCUMENT ME!

Specified by:
loadSecondStage in interface TwoStageLoader
Overrides:
loadSecondStage in class TLController
Parameters:
dictionaries - DOCUMENT ME!
Throws:
XMLInvalidInputException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!

createInstance

public java.lang.Object createInstance(java.lang.Class request)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.InstantiationException,
                                       java.lang.IllegalAccessException
DOCUMENT ME!

Specified by:
createInstance in interface InstantiationAssistant
Parameters:
request - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.ClassNotFoundException - DOCUMENT ME!
java.lang.InstantiationException - DOCUMENT ME!
java.lang.IllegalAccessException - DOCUMENT ME!

canCreateInstance

public boolean canCreateInstance(java.lang.Class request)
DOCUMENT ME!

Specified by:
canCreateInstance in interface InstantiationAssistant
Parameters:
request - DOCUMENT ME!
Returns:
DOCUMENT ME!

showSettings

public void showSettings(Controller c)
DOCUMENT ME!

Overrides:
showSettings in class TLController
Parameters:
c - DOCUMENT ME!