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

java.lang.Object
  extended by org.jscience.architecture.traffic.algorithms.tlc.TLController
All Implemented Interfaces:
TwoStageLoader, XMLSerializable
Direct Known Subclasses:
ACGJ1, ACGJ2, ACGJ3, ACGJ3FixedValue, ACGJ4, ACGJ5, BestFirstTLC, GenNeuralTLC, LocalHillTLC, LongestQueueTLC, MostCarsTLC, RandomTLC, RelativeLongestQueueTLC, RLD2TLC, RLDTLC, SL1TLC, SL2TLC, SL3TLC, SL4TLC, SL5TLC, SL6TLC, TC1B1, TC1TLCDestless, TC1TLCFix, TC1TLCOpt, TC2B1, TC2Final, TC2TLCDestless, TC2TLCOpt, TC3B1, TC3Opt, TC3TLCWorkInProgress

public abstract class TLController
extends java.lang.Object
implements XMLSerializable, TwoStageLoader

This is the abstract class for Traffic light algorithms. It is informed about every movement made by road users. In this way not every road user has to be iterated. By using this information it provides a table containing Q-values(reward values) for each trafficlight in it's 'Green' setting.


Nested Class Summary
protected  class TLController.TLCDialog
          The dialog used to set TLController properties.
protected  class TLController.TLCSettings
          Class used in combination with TLCDialog to modify TLC-specific settings.
 
Field Summary
protected  Infrastructure infra
          DOCUMENT ME!
protected  int num_tls
          DOCUMENT ME!
protected  TLDecision[][] tld
          DOCUMENT ME!
 int trackNode
          DOCUMENT ME!
 
Method Summary
protected  void applyGainValues(TLDecision[][] array, float[][] value)
          Apply an array of Gain-values to an array of TLDecisions Assumes that the dimensions of the two arrays are equal.
 TLDecision[][] createDecisionArray(Infrastructure infra)
          Creates a TLDecision[][] for the given infrastructure.
abstract  TLDecision[][] decideTLs()
          Calculates how every traffic light should be switched
protected  TLController.TLCSettings doSettingsDialog(Controller c, TLController.TLCSettings settings)
          Shows the TLC settings dialog for the given TLCSettings.
protected  float[][] getGainValuesFromDecisionArray(TLDecision[][] array)
          Extracts the Gain-values of a decision array for load/save
 Infrastructure getInfrastructure()
          DOCUMENT ME!
 int getNumTLs()
          Returns the number of TrafficLights in this Infrastructure
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
 void loadSecondStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
 void reset()
          Resets the Algorithm
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setInfrastructure(Infrastructure i)
          DOCUMENT ME!
 void setParentName(java.lang.String parentName)
          DOCUMENT ME!
 void showSettings(Controller c)
          To be overridden by subclasses if TLC settings are to be modified.
 void trackNode(int i)
          Sets the Node that can be tracked during excecution of a TLC
abstract  void updateRoaduserMove(Roaduser _ru, Drivelane _prevlane, Sign _prevsign, int _prevpos, Drivelane _dlanenow, Sign _signnow, int _posnow, PosMov[] posMovs, Drivelane _desiredLane)
          DOCUMENT ME!
 
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
getXMLName
 

Field Detail

infra

protected Infrastructure infra
DOCUMENT ME!


tld

protected TLDecision[][] tld
DOCUMENT ME!


trackNode

public int trackNode
DOCUMENT ME!


num_tls

protected int num_tls
DOCUMENT ME!

Method Detail

getInfrastructure

public Infrastructure getInfrastructure()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setInfrastructure

public void setInfrastructure(Infrastructure i)
DOCUMENT ME!

Parameters:
i - DOCUMENT ME!

decideTLs

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

Returns:
DOCUMENT ME!
See Also:
gld.algo.tlc.TLDecision

createDecisionArray

public TLDecision[][] createDecisionArray(Infrastructure infra)
Creates a TLDecision[][] for the given infrastructure. All Q values are set to 0

Parameters:
infra - DOCUMENT ME!
Returns:
DOCUMENT ME!

getGainValuesFromDecisionArray

protected float[][] getGainValuesFromDecisionArray(TLDecision[][] array)
Extracts the Gain-values of a decision array for load/save

Parameters:
array - DOCUMENT ME!
Returns:
DOCUMENT ME!

applyGainValues

protected void applyGainValues(TLDecision[][] array,
                               float[][] value)
Apply an array of Gain-values to an array of TLDecisions Assumes that the dimensions of the two arrays are equal.

Parameters:
array - DOCUMENT ME!
value - DOCUMENT ME!

reset

public void reset()
Resets the Algorithm


trackNode

public void trackNode(int i)
Sets the Node that can be tracked during excecution of a TLC

Parameters:
i - DOCUMENT ME!

getNumTLs

public int getNumTLs()
Returns the number of TrafficLights in this Infrastructure

Returns:
DOCUMENT ME!

updateRoaduserMove

public abstract void updateRoaduserMove(Roaduser _ru,
                                        Drivelane _prevlane,
                                        Sign _prevsign,
                                        int _prevpos,
                                        Drivelane _dlanenow,
                                        Sign _signnow,
                                        int _posnow,
                                        PosMov[] posMovs,
                                        Drivelane _desiredLane)
DOCUMENT ME!

Parameters:
_ru - DOCUMENT ME!
_prevlane - DOCUMENT ME!
_prevsign - DOCUMENT ME!
_prevpos - DOCUMENT ME!
_dlanenow - DOCUMENT ME!
_signnow - DOCUMENT ME!
_posnow - DOCUMENT ME!
posMovs - DOCUMENT ME!
_desiredLane - 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!

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!

loadSecondStage

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

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

showSettings

public void showSettings(Controller c)
To be overridden by subclasses if TLC settings are to be modified.

Parameters:
c - DOCUMENT ME!

doSettingsDialog

protected TLController.TLCSettings doSettingsDialog(Controller c,
                                                    TLController.TLCSettings settings)
Shows the TLC settings dialog for the given TLCSettings.

Parameters:
c - DOCUMENT ME!
settings - DOCUMENT ME!
Returns:
DOCUMENT ME!