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

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

public class LocalHillTLC
extends TLController
implements Colearning

This controller will decide it's Q values for the traffic lights according to the traffic situation on / the lane connected to the TrafficLight. It will learn how to alter it's outcome by reinforcement learning.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
TLController.TLCDialog, TLController.TLCSettings
 
Field Summary
protected  Node[] allnodes
          DOCUMENT ME!
protected  Infrastructure infrastructure
          DOCUMENT ME!
protected  int iteration_length
          DOCUMENT ME!
protected  int num_nodes
          DOCUMENT ME!
protected  int numSigns
          DOCUMENT ME!
protected  java.util.Random seed
          DOCUMENT ME!
protected static java.lang.String shortXMLName
          DOCUMENT ME!
protected  java.util.Vector tld_backup
          DOCUMENT ME!
protected  int[] v_table
          DOCUMENT ME!
 
Fields inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
infra, num_tls, tld, trackNode
 
Constructor Summary
LocalHillTLC(Infrastructure infra)
          The constructor for TL controllers
 
Method Summary
protected  void changeTLD(Node thisnode, Sign[] config)
          DOCUMENT ME!
protected  int computePoints(TLDecision[][] tld)
          DOCUMENT ME!
 TLDecision[][] decideTLs()
          Calculates how every traffic light should be switched Per node, per sign the waiting roadusers are passed and per each roaduser the gain is calculated.
 float getColearnValue(Sign now, Sign sign, Node des, int pos)
          DOCUMENT ME!
 java.lang.String getXMLName()
          DOCUMENT ME!
protected  boolean isRed(TLDecision[] tld_node, int sign_id)
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
 void loadSecondStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
protected  void reset_v_table()
          DOCUMENT ME!
protected  void restoreTLD(Node thisnode)
          DOCUMENT ME!
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setInfrastructure(Infrastructure infra)
          DOCUMENT ME!
 void showSettings(Controller c)
          DOCUMENT ME!
 void updateRoaduserMove(Roaduser ru, Drivelane currentlane, Sign currentsign, int prevpos, Drivelane nextlane, Sign nextsign, int posnow, PosMov[] posMovs, Drivelane desired)
          DOCUMENT ME!
 
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
 

Field Detail

shortXMLName

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

See Also:
Constant Field Values

infrastructure

protected Infrastructure infrastructure
DOCUMENT ME!


allnodes

protected Node[] allnodes
DOCUMENT ME!


num_nodes

protected int num_nodes
DOCUMENT ME!


numSigns

protected int numSigns
DOCUMENT ME!


seed

protected java.util.Random seed
DOCUMENT ME!


tld_backup

protected java.util.Vector tld_backup
DOCUMENT ME!


v_table

protected int[] v_table
DOCUMENT ME!


iteration_length

protected final int iteration_length
DOCUMENT ME!

See Also:
Constant Field Values
Constructor Detail

LocalHillTLC

public LocalHillTLC(Infrastructure infra)
             throws InfraException
The constructor for TL controllers

Parameters:
infra - model being used.
Throws:
InfraException - DOCUMENT ME!
Method Detail

setInfrastructure

public void setInfrastructure(Infrastructure infra)
DOCUMENT ME!

Overrides:
setInfrastructure in class TLController
Parameters:
infra - DOCUMENT ME!

decideTLs

public TLDecision[][] decideTLs()
Calculates how every traffic light should be switched Per node, per sign the waiting roadusers are passed and per each roaduser the gain is calculated.

Specified by:
decideTLs in class TLController
Returns:
DOCUMENT ME!
See Also:
gld.algo.tlc.TLDecision

reset_v_table

protected void reset_v_table()
DOCUMENT ME!


computePoints

protected int computePoints(TLDecision[][] tld)
                     throws InfraException
DOCUMENT ME!

Parameters:
tld - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
InfraException - DOCUMENT ME!

updateRoaduserMove

public void updateRoaduserMove(Roaduser ru,
                               Drivelane currentlane,
                               Sign currentsign,
                               int prevpos,
                               Drivelane nextlane,
                               Sign nextsign,
                               int posnow,
                               PosMov[] posMovs,
                               Drivelane desired)
DOCUMENT ME!

Specified by:
updateRoaduserMove in class TLController
Parameters:
ru - DOCUMENT ME!
currentlane - DOCUMENT ME!
currentsign - DOCUMENT ME!
prevpos - DOCUMENT ME!
nextlane - DOCUMENT ME!
nextsign - DOCUMENT ME!
posnow - DOCUMENT ME!
posMovs - DOCUMENT ME!
desired - DOCUMENT ME!

isRed

protected boolean isRed(TLDecision[] tld_node,
                        int sign_id)
DOCUMENT ME!

Parameters:
tld_node - DOCUMENT ME!
sign_id - DOCUMENT ME!
Returns:
DOCUMENT ME!

changeTLD

protected void changeTLD(Node thisnode,
                         Sign[] config)
DOCUMENT ME!

Parameters:
thisnode - DOCUMENT ME!
config - DOCUMENT ME!

restoreTLD

protected void restoreTLD(Node thisnode)
DOCUMENT ME!

Parameters:
thisnode - DOCUMENT ME!

getColearnValue

public float getColearnValue(Sign now,
                             Sign sign,
                             Node des,
                             int pos)
DOCUMENT ME!

Specified by:
getColearnValue in interface Colearning
Parameters:
now - DOCUMENT ME!
sign - DOCUMENT ME!
des - DOCUMENT ME!
pos - 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
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!

showSettings

public void showSettings(Controller c)
DOCUMENT ME!

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