sync with online documentation authored by Mohcine Chraibi's avatar Mohcine Chraibi
---
layout: post
title: Way finding
subtitle: routing
#bigimg: /img/jupedsim_small.png
permalink: 2016-11-03-routing.html
---
Different router are implemented. However:
<div class="alert alert-danger">
<strong>Refactoring! </strong>Actually the router-class is undergoing a major refactoring ...
</div>
## Floorfield Router
The floorfield-router is our latest router, which uses floorfields
to calculate the distances among the doors of the same `subroom`.
The major difference to any other router is, that it does __not__
need convex subrooms/rooms any longer. There is no need for adding
helplines.
It fills an adjacency matrix and calculates global-shortest paths via the
Floyd-Warshall algorithm.
The floorfield-router will give intermediate targets within the`subroom`
of each agent. It works in combination with exit strategies 8 and 9.[^str_8_9]
<div class="alert alert-info">
<strong>3D geometries: </strong> To use it successfully in multi-storage buildings, the user must provide
a geometry file, where stair-cases (or any other structur), which connects
two floors/levels <b>must</b> be a separate room. Further, that room
<b>must</b> only connect two levels. Rooms stretching over more than
2 levels are not valid.
</div>
If there are two points with the same ($$x, y$$)-coordinates, which differ
only in the $$z$$-coordinate, the router will face problems, thus we defined
the restriction above. That should avoid any such cases.
The floorfield router provides one mode: ```ff_global_shortest```
```ff_local_shortest``` and ```ff_quickest``` will follow shortly.
<div class="alert alert-info">
<strong>Important! </strong>If you use a router, which allows non-convex subrooms/rooms, you should use an exit-strategy,
which also allows non-convex subrooms/rooms.
Exit-strategies 8 and 9 will work best with the floorfield router.
</div>
Following snippet is a definition example of the routing information:
```xml
<route_choice_models>
<router router_id="1" description="ff_global_shortest">
</router>
<!-- Not yet implemented -->
<!--router router_id="2" description="ff_local_shortest">
</router-->
<!-- Not yet implemented -->
<!--router router_id="3" description="ff_quickest">
</router-->
</route_choice_models>
```
## Global shortest path
At the beginning of the simulation, the Dijkstra algorithm is used to
build a network which is then cached and used through the simulation
life time.
Detailed information about the aforementioned models
are presented in: [KemlohWagoum2012a][#KemlohWagoum2012a]
Following snippet is a definition example of the routing information:
```xml
<route_choice_models>
<router router_id="1" description="global_shortest">
<parameters>
<navigation_lines file="routing.xml" />
</parameters>
</router>
</route_choice_models>
```
## The cognitive map
See this [talk](http://www.citg.tudelft.nl/fileadmin/Faculteit/CiTG/Over_de_faculteit/Afdelingen/Afdeling_Transport_en_Planning/conference/tgf15/presentations/wednesday/session_a/Andresen_tgf2015.pdf) to get the idea
[Smoke sensor documentation in JPSfire](https://cst.version.fz-juelich.de/jupedsim/JPSfire)
```xml
<router router_id="7" description="cognitive_map">
<sensors>
<sensor sensor_id="1" description="Room2Corridor"/>
<sensor sensor_id="2" description="Smoke" p_field_path="D:\JuPedSim\jpscore\inputfiles\cognitive_map\pFields\" update_time="30" final_time="300"/>
</sensors>
<cognitive_map status="complete" />
</router>
```
## Updates
For current development updates, please check this [issue](https://cst.version.fz-juelich.de/jupedsim/jpscore/issues/127) on our GitLab Repo.
[^str_8_9]: If convex subrooms are provided, any exit strategy will work.
In these special cases, global router will be faster in computation time.
[#KemlohWagoum2012a]: dx.doi.org/10.1142%2FS0219525912500294 "Kemloh et al "Modeling the dynamic route choice of pedestrians to assess the criticality of building evacuation. Advances in Complex Systems. 2012"