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

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

public class ACGJ2
extends TLController
implements XMLSerializable, TwoStageLoader, InstantiationAssistant

This algorithm will, when it starts, handle like Longest Queue, but it can do more things: 1. It prevents infinite waiting of Roadusers 2. It tries to create green waves between busy nodes. The green_wave-factor is editable as a parameter. 3. The algorithm can be stimulated to develop patterns in TL-configuration-settings, therefore it remembers the last 100 configurations. This pattern factor is also editable 4. This algorithm has a keep green factor. This editable factor is an extra weight to keep the lights green, that were green in the previous cycle.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
TLController.TLCDialog, TLController.TLCSettings
 
Field Summary
protected  org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NextCycles bestSoFar
          DOCUMENT ME!
protected static float GREEN_WAVE_FACTOR
          DOCUMENT ME!
protected static float KEEP_GREEN_FACTOR
          DOCUMENT ME!
protected static float LOOK_AHEAD_FACTOR
          DOCUMENT ME!
protected  org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] ndinf
          DOCUMENT ME!
protected static float PAT_FACTOR
          DOCUMENT ME!
protected static java.lang.String shortXMLName
          DOCUMENT ME!
 
Fields inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
infra, num_tls, tld, trackNode
 
Constructor Summary
ACGJ2(Infrastructure i)
          Creates a new ACGJ2 object.
 
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 loadThirdStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setInfrastructure(Infrastructure i)
          DOCUMENT ME!
 void showSettings(Controller c)
          DOCUMENT ME!
 org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] sortNodeInfo(org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] ndi)
          DOCUMENT ME!
 void updateRoaduserMove(Roaduser _ru, Drivelane _prevlane, Sign _prevsign, int _prevpos, Drivelane _dlanenow, Sign _signnow, 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
 
Methods inherited from interface org.jscience.architecture.traffic.xml.XMLSerializable
setParentName
 

Field Detail

shortXMLName

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

See Also:
Constant Field Values

PAT_FACTOR

protected static float PAT_FACTOR
DOCUMENT ME!


KEEP_GREEN_FACTOR

protected static float KEEP_GREEN_FACTOR
DOCUMENT ME!


GREEN_WAVE_FACTOR

protected static float GREEN_WAVE_FACTOR
DOCUMENT ME!


LOOK_AHEAD_FACTOR

protected static float LOOK_AHEAD_FACTOR
DOCUMENT ME!


ndinf

protected org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] ndinf
DOCUMENT ME!


bestSoFar

protected org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NextCycles bestSoFar
DOCUMENT ME!

Constructor Detail

ACGJ2

public ACGJ2(Infrastructure i)
Creates a new ACGJ2 object.

Parameters:
i - DOCUMENT ME!
Method Detail

setInfrastructure

public void setInfrastructure(Infrastructure i)
DOCUMENT ME!

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

decideTLs

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

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

sortNodeInfo

public org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] sortNodeInfo(org.jscience.architecture.traffic.algorithms.tlc.ACGJ2.NodeInfo[] ndi)
DOCUMENT ME!

Parameters:
ndi - DOCUMENT ME!
Returns:
DOCUMENT ME!

updateRoaduserMove

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

Specified by:
updateRoaduserMove in class TLController
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!
desired - DOCUMENT ME!

showSettings

public void showSettings(Controller c)
DOCUMENT ME!

Overrides:
showSettings in class TLController
Parameters:
c - 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!

loadThirdStage

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

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!