Skip to content

Commit

Permalink
Merge pull request #5 from nonifier/patch-1
Browse files Browse the repository at this point in the history
Typos & co
  • Loading branch information
XL committed Aug 23, 2019
2 parents 99131e5 + 30b70f5 commit ca09f51
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions doc/multimodal_in_valhalla.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Multimodal Pathfinder in Valhalla
# Multimodal Pathfinder with Valhalla

<p align="center">
<b>Roses are red,<br>
Expand All @@ -10,7 +10,7 @@ I don't want to be late for my rendezvous</b>
## Overview

The algorithm that we introduce in this document can be applied in multimodal pathfinding. More particularly, we're going
to use Bike Sharing System(BSS) as example.
to use Bike Sharing System(BSS) as an example.

In the case of BSS, two scenarios may happen:

Expand All @@ -19,14 +19,14 @@ be able to find a journey on foot

2. The origin and the destination are far away from each other, Valhalla should be able to find a journey on foot
leading the user to a BSS station then another journey by bike leading the user to a another BSS station close to the
destination in order to put the bike back and finally a journey, on foot again, from the second BSS station to the
destination in order to park the bike and finally a journey, on foot again, from the second BSS station to the
destination.

## Algorithm

The whole Prove of Concept is based on the existing algorithms A*, which is used in Valhalla widely.
The whole Prove of Concept is based on the existing algorithms A*, which is widely used in Valhalla.

To understand the multimodal A*, we can image that we are going to explore a graph that have two different layers
To understand the multimodal A*, we can imagine that we are going to explore a graph that has two different layers
which represent **foot layer** and **bike layer** respectively. The BSS stations are the nodes/edges that connect those
two layers and through which the traveller can change the travel mode. With that said, we are actually constructing a
larger graph by "separating" the nodes and the edges of different modes from the original graph and classic path finding
Expand All @@ -35,19 +35,19 @@ algorithms can work on this larger graph as usual. In the case of BSS, both orig
form the BSS station, go somewhere without "putting back" the bike (aka a "via"), we only need to project the
destination on the **bike layer**.

The only trick of making the "separation" happen is to add new attribute: `travel_mode` into the key of`real_cost`(see
The only trick to making the "separation" happen is to add a new attribute `travel_mode` into the key of `real_cost`(see
below for more details).

* **Nomenclature**

* **pred_map**: predecessor of the current node, used to build the final path
* **real_cost**: map of real cost of the journey, whose keys are `node, travel_mode`, In this project, we use the sum of normlized length of the journey.
* **open_set**: a set of nodes to be visited, as classic implementation, we use a priority queue, who
* **open_set**: a set of nodes to be visited, as classic implementation, we use a priority queue
* **closed_set**: a set of nodes that has already the optimal solution
* **normalize_cost**: to be able to accumulate the cost of different modes, we have to normalize the cost. In this
project, we use `the length of the edge` * `1` as the cost of foot mode and
`the length of the edge` * `foot speed / bike speed`, which actually means on bike, it will cost less/more.
* **normalize_heuristic_cost**: it's the same idea of **normalize_cost**. In this project, we use
* **normalize_heuristic_cost**: it's the same idea as **normalize_cost**. In this project, we use
`the crowfly distance` * `1` as the heuristic cost of foot mode and `the crowfly distance` * `foot speed / bike speed` as
the heuristic cost of bike mode

Expand Down Expand Up @@ -111,14 +111,14 @@ def multimodal_A_star(origin, destination):

```

Example of a exploration, final result is on BSS
Example of an exploration, final result is on BSS
![Point to Point on BSS](../example_images/double_expansion_one_queue_bss.gif?raw=true)

Example of a exploration, final result is on foot
![Point to Point on foot](../example_images/double_expansion_one_queue_foot.gif?raw=true "Point to Point on foot")

* **Isochrone**

The algorithm of isochrone is quite simple, we only need to set heuristic cost to zero, and it's done.
The isochrone algorithm is quite simple, we only need to set heuristic cost to zero, and it's done.

![Isochrone on BSS](../example_images/double_expansion_isochrone.gif?raw=true "Isochrone on BSS")

0 comments on commit ca09f51

Please sign in to comment.