Skip to content
Antoine "Avzgui" Richard edited this page Aug 2, 2015 · 9 revisions

How the environment was created ?

The environment is a dynamical matrix of infrastructures, who could be roads or intersections. And those infrastructures are also defined by a matrix of cells. So the environnement is a matrix of cells, but not directly.

XML Initialisation

The model class has a method used to load an environment (or rather a roads network) from a XML file who respect the DTD below.

<?xml version="1.0" encoding="UTF-8"?>

<!-- Elements' definition -->
<!ELEMENT network (intersection|road)+>
<!ELEMENT intersection (indonesian, cardinal, cardinal, cardinal, cardinal)>
<!ELEMENT road (cardinal, cardinal)>
<!ELEMENT indonesian (#PCDATA)>
<!ELEMENT cardinal (flow, flow)>
<!ELEMENT flow (ways, size)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT ways (#PCDATA)>

<!-- Elements' attributes -->
<!ATTLIST intersection 
    x CDATA #REQUIRED
    y CDATA #REQUIRED
>

<!ATTLIST road 
    x CDATA #REQUIRED
    y CDATA #REQUIRED
>

<!ATTLIST cardinal 
    type (north|east|south|west) #REQUIRED
>

<!ATTLIST flow 
    type (in|out) #REQUIRED
>

Intersection Creation

An intersection is defined by several parameters :

  • Its number of lane in the different input and output (North, South, East and West).
  • Its size of the different input and ouput.
  • Its position in the infrastructures' map.

An agent's layered design pattern

When the model class is loading the environment, and more particularly an intersection, it create the intersection and determine its position in the cells' map compared to its neighbors infrastructures.

It's the intersection class who, with its paramaters, will creates all its trajectories.

Road Creation

TODO

How to get some statistics from the MAS ?

The best way to get statistics from the MAS with our implementation is to use the agent classes as observer of the its body and brain classes. And made the model class as the observer of the agent classes.

Then the model class will write this statistics in a file, for each simulation.