Simulation/Rerouter
Contents
Rerouter
Rerouter changes the route of a vehicle as soon as the vehicle moves onto a specified edge.
A rerouter is set into the simulated network by adding the following declaration line to an additional-file: <rerouter id="<REROUTER_ID>" edges="<EDGE_ID>[;<EDGE_ID>]*" file="<DEFINITION_FILE>" [probability="<PROBABILITY>"]/>. Rerouter may be placed on several edges, at least one edge is necessary. Furthermore, it is possible to define the probability for rerouting a vehicle by giving a number between 0 (none) and 1 (all) already within the definition. The declaration values are:
| Attribute Name | Value Type | Description |
|---|---|---|
| id | id (string) | The id of of the rerouter |
| edges | float | An edge id or a list of edge ids where vehicles shall be rerouted |
| file | float | The path to the definition file (alternatively, the intervals may defined as children of the rerouter) |
| probability | float | The probability for vehicle rerouting (0-1), default 1 |
A rerouter may work in several different ways. Within a time period you may close an edge, or assign new destinations or predefined routes to vehicles. The next sections will describe these actions in detail.
Definition styles
There are two styles in which to declare rerouters.
everything in one file
The additional-file looks like this:
<additional>
<rerouter id="<REROUTER_ID>" edges="<EDGE_ID>[;<EDGE_ID>]*" [probability="<PROBABILITY>"]>
<interval begin="<BEGIN_TIME>" end="<END_TIME>">
... action description ...
</interval>
... further intervals ...
</rerouter>
... further rerouters ...
</additional>
definitions in a separate file
The additional-file looks like this:
<additional> <rerouter id="<REROUTER_ID>" edges="<EDGE_ID>[;<EDGE_ID>]*" file="<DEFINITION_FILE>" [probability="<PROBABILITY>"]/> ... further rerouters ... </additional>
And the <DEFINITION_FILE> (which describes the actions over time) looks like this:
<rerouter>
<interval begin="<BEGIN_TIME>" end="<END_TIME>">
... action description ...
</interval>
... further intervals ...
</rerouter>
Note, that the name of the root-level element (<rerouter> in this case) is arbitrary.
Closing a Street
A "closing_reroute" forces the rerouter to close the edge <EDGE_ID>. Vehicles which normally would pass this edge will get a new route as soon as they reach one of the edges given in the edges-attribute of the rerouter's declaration. a closing_reroute definition may look like this:
<rerouter>
<interval begin="<BEGIN_TIME>" end="<END_TIME>">
<closingReroute id="<EDGE_ID>"/>
</interval>
... further intervals ...
</rerouter>
The attributes used within such definitions are:
| Attribute Name | Value Type | Description |
|---|---|---|
| id | id (string) | The id of the closed edge; the id must be the id of an edge within the network |
| allow | list of vehicle classes | The (optional) ' '-separated list of vehicle classes which are still allowed to drive on the closed edge. All others are forbidden. |
| disallow | list of vehicle classes | The (optional) ' '-separated list of vehicle classes which are forbidden from driving on the closed edge. All others are allowed. |
When using a <closingReroute without attributes allow and disallow, vehicles that cannot reach their destination by an alternative route simply continue on their old route and will effectively ignore the closing of the edges. When using either attribute allow or disallow (only one may be used in the same definition), vehicles which cannot change their route will stop in front of the closed edge until the defined interval ends. This may be used to simulate traffic jams, caused by spontaneous road closing.
In order to make use of modified edge permissions, the vehicles have to be defined with an appropriate vehicle class. By default, vehicles will ignore vClass-restrictions. Furthermore, it may be necessary to use the option --ignore-route-errors as vehicles which are inserted while the closing is active may raise a route error otherwise.
Assigning a new Destination
A "dest_prob_reroute" forces the rerouter to assign a new route to vehicles that pass one of the edges defined in the edges-attribute of the rerouter's declaration. A new route destination is used, defined by the name of a new destination in the according element:
<rerouter>
<interval begin="<BEGIN_TIME>" end="<END_TIME>">
<destProbReroute id="<EDGE_ID1>" probability="<PROBABILITY1>"/>
<destProbReroute id="<EDGE_ID2>" probability="<PROBABILITY2>"/>
</interval>
... further intervals ...
</rerouter>
The route is computed automatically using the Dijkstra-algorithm and starting at the edge the vehicle is located at and ending at the new destination. The new route will be the fastest route in the empty network.
The attributes used within a dest_prob_reroute are:
| Attribute Name | Value Type | Description |
|---|---|---|
| id | id (string) | The id of the new destination; the id must be the id of an edge within the network or one of the special values keepDestination, terminateRoute |
| probability | float (should be between 0 and 1) | The probability with which a vehicle will use the given edge as destination; the probabilities are automatically normalized to sum to 1 |
It is possible to combine closingReroute and destProbReroute within the same interval. In this case, only vehicles which cannot reach their original destination draw new destinations from the probability distribution.
Assigning a new Route
A "route_prob_reroute" forces the rerouter to assign a new route to vehicles which pass one of the edges defined in the edges-attribute of the rerouter's declaration. In this case, the id of a complete route must be supplied instead of a new destination:
<rerouter>
<interval begin="<BEGIN_TIME>" end="<END_TIME>">
<routeProbReroute id="<ROUTE_ID1>" probability="<PROBABILITY1>"/>
<routeProbReroute id="<ROUTE_ID2>" probability="<PROBABILITY2>"/>
</interval>
... further intervals ...
</rerouter>
The attributes used within such definitions are:
| Attribute Name | Value Type | Description |
|---|---|---|
| id | id (string) | The id of a new route to assign; the id must be the id of a previously loaded route |
| probability | float (should be between 0 and 1) | The the probability with which a vehicle will use the given edge as destination; the sum of the probabilities should be 1 |