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

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

public class ACGJ3FixedValue
extends TLController
implements InstantiationAssistant, XMLSerializable

Now with extra improved but still sometimes not too great performance!


Nested Class Summary
protected  class ACGJ3FixedValue.ACGJ3FixedValueIndividual
          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 int BUCK
          Used constants for array addressing
protected static int DECF
          Used constants for array addressing
protected static float DECREASE
          Constants used for calculating gains
protected  ACGJ3FixedValue.ACGJ3FixedValueIndividual ind
          the current ACGJ3Individual that is running
protected  Infrastructure infra
          The infrastructure which this algorithm runs on
protected  int num_nodes
          counter for the number of roadusers that did move
protected  java.util.Random random
          The pseudo-random number generator for generating the chances that certain events will occur
protected static float RUWAIT
          Constants used for calculating gains
protected static int RUWF
          Used constants for array addressing
protected static java.lang.String shortXMLName
          DOCUMENT ME!
protected static int WAIT
          Used constants for array addressing
 
Fields inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController
num_tls, tld, trackNode
 
Constructor Summary
ACGJ3FixedValue(Infrastructure _i)
          Creates a new ACGJ3 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 reset()
          Resets the algorithm
 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, loadSecondStage, 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

DECREASE

protected static float DECREASE
Constants used for calculating gains


RUWAIT

protected static float RUWAIT
Constants used for calculating gains


BUCK

protected static final int BUCK
Used constants for array addressing

See Also:
Constant Field Values

WAIT

protected static final int WAIT
Used constants for array addressing

See Also:
Constant Field Values

DECF

protected static final int DECF
Used constants for array addressing

See Also:
Constant Field Values

RUWF

protected static final int RUWF
Used constants for array addressing

See Also:
Constant Field Values

shortXMLName

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

See Also:
Constant Field Values

num_nodes

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


ind

protected ACGJ3FixedValue.ACGJ3FixedValueIndividual ind
the current ACGJ3Individual that is running


random

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


infra

protected Infrastructure infra
The infrastructure which this algorithm runs on


assistant

protected InstantiationAssistant assistant
DOCUMENT ME!

Constructor Detail

ACGJ3FixedValue

public ACGJ3FixedValue(Infrastructure _i)
Creates a new ACGJ3 Algorithm. This TLC-algorithm is using genetic 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

reset

public void reset()
Resets the algorithm

Overrides:
reset in class TLController

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 -

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!

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!