[go: up one dir, main page]

Skip to content

skamsie/berlin-subway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

berlin-subway

Route finding algorithm written in prolog.
Find all routes between station A and station B and sort them by shortest time.

Case study

Berlin Subway (Ubahn)
Mapped lines: U1 -> U9

Use

Install swi prolog
brew install swi-prolog or see here
Launch the REPL in the project folder with swipl

In the REPL

  • load the program with [rails]. or ['rails.pl'].
  • use predicate route/2
  • ; next result, . stop
  • exit the repl with halt.
?- [rails].
true.

?- route(alexanderplatz, 'kottbusser tor').

alexanderplatz u8 -> kottbusser tor  ❯ hermannstrasse (4)
6.9 minutes / 3.0 km
true ;
alexanderplatz u2 -> stadtmitte  ❯ ruhleben (5)
stadtmitte u6 -> hallesches tor  ❯ alt-mariendorf (2)
hallesches tor u1 -> kottbusser tor  ❯ warschauer strasse (2)
21.3 minutes / 5.9 km
true ;
alexanderplatz u2 -> gleisdreieck  ❯ ruhleben (9)
gleisdreieck u1 -> kottbusser tor  ❯ warschauer strasse (4)
22.4 minutes / 7.8 km
true .

Releases

No releases published

Packages

No packages published

Languages