|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.architecture.traffic.algorithms.tlc.TLController
org.jscience.architecture.traffic.algorithms.tlc.TC2B1
public class TC2B1
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. TC2 According to Garp, eh, Jilles
| Nested Class Summary | |
|---|---|
class |
TC2B1.CountEntry
DOCUMENT ME! |
class |
TC2B1.PEntry
|
class |
TC2B1.PKtlEntry
DOCUMENT ME! |
protected class |
TC2B1.Target
DOCUMENT ME! |
| 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 static int |
BUCK
DOCUMENT ME! |
protected float[][] |
bucket
DOCUMENT ME! |
protected java.util.Vector[][][] |
count
DOCUMENT ME! |
protected static float |
gamma
DOCUMENT ME! |
protected static boolean |
green
DOCUMENT ME! |
protected static int |
green_index
DOCUMENT ME! |
protected Infrastructure |
infrastructure
DOCUMENT ME! |
protected int |
num_nodes
DOCUMENT ME! |
protected java.util.Vector[][][] |
pKtlTable
DOCUMENT ME! |
protected java.util.Vector[][][] |
pTable
DOCUMENT ME! |
protected float[][][][] |
qTable
DOCUMENT ME! |
protected static float |
random_chance
DOCUMENT ME! |
protected static boolean |
red
DOCUMENT ME! |
protected static int |
red_index
DOCUMENT ME! |
static java.lang.String |
shortXMLName
DOCUMENT ME! |
protected TrafficLight[][] |
tls
DOCUMENT ME! |
protected float[][][] |
vTable
DOCUMENT ME! |
protected static int |
WAIT
DOCUMENT ME! |
| Fields inherited from class org.jscience.architecture.traffic.algorithms.tlc.TLController |
|---|
infra, num_tls, tld, trackNode |
| Constructor Summary | |
|---|---|
TC2B1(Infrastructure infra)
The constructor for TL controllers |
|
| Method Summary | |
|---|---|
protected float[] |
calcPGR(int tlId,
int pos,
int desId)
|
protected boolean |
calcPossibleCross(int tlId,
PosMov[] posMovs)
DOCUMENT ME! |
protected int |
calcReward(int tlId,
int pos,
int tlNewId,
int posNew)
DOCUMENT ME! |
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 Per node, per sign the waiting roadusers are passed and per each roaduser the gain is calculated. |
float |
getColearnValue(Sign sign_new,
Sign sign,
Node destination,
int pos)
DOCUMENT ME! |
float |
getVValue(Sign sign,
Node des,
int pos)
DOCUMENT ME! |
java.lang.String |
getXMLName()
DOCUMENT ME! |
void |
load(XMLElement myElement,
XMLLoader loader)
DOCUMENT ME! |
void |
loadSecondStage(java.util.Dictionary dictionaries)
DOCUMENT ME! |
protected void |
recalcP(int tlId,
int pos,
int desId,
boolean light,
int tlNewId,
int posNew,
int Ktl)
DOCUMENT ME! |
protected void |
recalcQ(int tlId,
int pos,
int desId,
boolean light,
int tlNewId,
int posNew,
PosMov[] posMovs,
int Ktl)
DOCUMENT ME! |
protected void |
recalcV(int tlId,
int pos,
int desId)
DOCUMENT ME! |
protected void |
relaxBucket(Drivelane prevlane,
int prevpos)
Empties the 'gain-value' bucket partly, which is being filled when Roadusers are waiting/voting for their TrafficLight to be set to green. |
void |
saveChilds(XMLSaver saver)
DOCUMENT ME! |
XMLElement |
saveSelf()
DOCUMENT ME! |
void |
setInfrastructure(Infrastructure infra)
DOCUMENT ME! |
void |
showSettings(Controller c)
DOCUMENT ME! |
protected void |
siphonGainToOtherBucket(Drivelane here,
Drivelane there)
When a Roaduser may drive according to it's Sign, but cant as the desired Drivelane is full, (some/all) of the current gain-bucket of it's current TrafficLight is siphoned over to the desired Drivelane, making it more probable that that lane will move, making it possible for this Drivelane to move. |
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 |
| Field Detail |
|---|
protected static final int BUCK
protected static final int WAIT
protected static float gamma
protected static final boolean red
protected static final boolean green
protected static final int green_index
protected static final int red_index
public static final java.lang.String shortXMLName
protected static float random_chance
protected Infrastructure infrastructure
protected TrafficLight[][] tls
protected Node[] allnodes
protected int num_nodes
protected float[][] bucket
protected java.util.Vector[][][] count
protected java.util.Vector[][][] pTable
protected java.util.Vector[][][] pKtlTable
protected float[][][][] qTable
protected float[][][] vTable
| Constructor Detail |
|---|
public TC2B1(Infrastructure infra)
throws InfraException
infra - infrastructure being used.
InfraException - DOCUMENT ME!| Method Detail |
|---|
public void setInfrastructure(Infrastructure infra)
setInfrastructure in class TLControllerinfra - DOCUMENT ME!public TLDecision[][] decideTLs()
decideTLs in class TLControllergld.algo.tlc.TLDecision
public void updateRoaduserMove(Roaduser ru,
Drivelane prevlane,
Sign prevsign,
int prevpos,
Drivelane dlanenow,
Sign signnow,
int posnow,
PosMov[] posMovs,
Drivelane desired)
updateRoaduserMove in class TLControllerru - 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!
protected void relaxBucket(Drivelane prevlane,
int prevpos)
prevlane - The Drivelane the Roaduser was on just before.prevpos - DOCUMENT ME!
protected void siphonGainToOtherBucket(Drivelane here,
Drivelane there)
here - the Id of the drivelane the Roaduser is waiting atthere - the Id of the drivelane where the Roaduser wants to go now
protected void recalcP(int tlId,
int pos,
int desId,
boolean light,
int tlNewId,
int posNew,
int Ktl)
tlId - DOCUMENT ME!pos - DOCUMENT ME!desId - DOCUMENT ME!light - DOCUMENT ME!tlNewId - DOCUMENT ME!posNew - DOCUMENT ME!Ktl - DOCUMENT ME!
protected void recalcQ(int tlId,
int pos,
int desId,
boolean light,
int tlNewId,
int posNew,
PosMov[] posMovs,
int Ktl)
tlId - DOCUMENT ME!pos - DOCUMENT ME!desId - DOCUMENT ME!light - DOCUMENT ME!tlNewId - DOCUMENT ME!posNew - DOCUMENT ME!posMovs - DOCUMENT ME!Ktl - DOCUMENT ME!
protected void recalcV(int tlId,
int pos,
int desId)
tlId - DOCUMENT ME!pos - DOCUMENT ME!desId - DOCUMENT ME!
protected float[] calcPGR(int tlId,
int pos,
int desId)
protected int calcReward(int tlId,
int pos,
int tlNewId,
int posNew)
tlId - DOCUMENT ME!pos - DOCUMENT ME!tlNewId - DOCUMENT ME!posNew - DOCUMENT ME!
protected boolean calcPossibleCross(int tlId,
PosMov[] posMovs)
tlId - DOCUMENT ME!posMovs - DOCUMENT ME!
public float getVValue(Sign sign,
Node des,
int pos)
sign - DOCUMENT ME!des - DOCUMENT ME!pos - DOCUMENT ME!
public float getColearnValue(Sign sign_new,
Sign sign,
Node destination,
int pos)
getColearnValue in interface Colearningsign_new - DOCUMENT ME!sign - DOCUMENT ME!destination - DOCUMENT ME!pos - DOCUMENT ME!
public void showSettings(Controller c)
showSettings in class TLControllerc - DOCUMENT ME!
public void load(XMLElement myElement,
XMLLoader loader)
throws XMLTreeException,
java.io.IOException,
XMLInvalidInputException
load in interface XMLSerializableload in class TLControllermyElement - DOCUMENT ME!loader - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!
public XMLElement saveSelf()
throws XMLCannotSaveException
saveSelf in interface XMLSerializablesaveSelf in class TLControllerXMLCannotSaveException - DOCUMENT ME!
public void saveChilds(XMLSaver saver)
throws XMLTreeException,
java.io.IOException,
XMLCannotSaveException
saveChilds in interface XMLSerializablesaveChilds in class TLControllersaver - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!public java.lang.String getXMLName()
getXMLName in interface XMLSerializable
public void loadSecondStage(java.util.Dictionary dictionaries)
throws XMLInvalidInputException,
XMLTreeException
loadSecondStage in interface TwoStageLoaderloadSecondStage in class TLControllerdictionaries - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!public boolean canCreateInstance(java.lang.Class request)
canCreateInstance in interface InstantiationAssistantrequest - DOCUMENT ME!
public java.lang.Object createInstance(java.lang.Class request)
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
createInstance in interface InstantiationAssistantrequest - DOCUMENT ME!
java.lang.ClassNotFoundException - DOCUMENT ME!
java.lang.InstantiationException - DOCUMENT ME!
java.lang.IllegalAccessException - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||