Giter VIP home page Giter VIP logo

rrrr's People

Contributors

abyrd avatar fanda avatar jordenverwer avatar koch-t avatar kornelski avatar oooits72 avatar skinkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rrrr's Issues

Mistake in bitset iteration

I think bitset_next_set_bit is skipping every bit where (index % 64 == 0), because the 1 in the 0 position is is being left shifted before it is used.

transferring from unreached stop

Bug reported by Thomas by email: Since making sure there are no duplicate stop_ids in a trip, we're getting "ERROR: transferring from unreached stop" in the forward searches.

I have confirmed that this happens only on forward searches. Cause: UNREACHED is UINT16_MAX - 1, so transfers and overnight trips can yield this value on day 2.

-- Router Request --
from:  Zutphen, De Martinet [3]
to:    Groenlo, De Molenberg [2]
date:  2013-07-23
time:  19:45:00 [1374601500]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 6
max time:     --   
ERROR: transferring from unreached stop.
A 3 VEHICLES 
walk;walk;Zutphen, De Martinet;19:45:00;Zutphen, Rijkenhage;19:45:00
bus 82 (Zutphen - Doetinchem);Doetinchem via Steenderen;Zutphen, Rijkenhage;20:16:00;Doetinchem, Station;21:00:00
walk;walk;Doetinchem, Station;21:00:00;Doetinchem, Station;21:00:00
bus 74 (Enschede - Doetinchem);Haaksbergen Busstation;Doetinchem, Station;21:09:00;Groenlo, Busstation;21:49:00
walk;walk;Groenlo, Busstation;21:49:00;Groenlo, Busstation;21:49:00
bus 198 (Rietmolen - Groenlo);Rietmolen Kerk;Groenlo, Busstation;22:05:00;Groenlo, De Molenberg;22:07:00
Repeating search with reversed request: 
-- Router Request --
from:  Zutphen, De Martinet [3]
to:    Groenlo, De Molenberg [2]
date:  2013-07-23
time:  22:07:00 [1374610020]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 2
max time:  02:08:28 +1D

A 3 VEHICLES 
walk;walk;Zutphen, De Martinet;20:55:00;Zutphen, Berkelsingel;20:55:00
bus 80 (Zutphen - Warnsveld);Zutphen via Gelre zkh;Zutphen, Berkelsingel;20:55:00;Zutphen, Busstation;20:57:00
walk;walk;Zutphen, Busstation;21:06:00;Zutphen;21:06:00
train Stoptrein (Winterswijk <-> Zutphen ST30800);Winterswijk;Zutphen;21:06:00;Lichtenvoorde-Groenlo;21:30:00
walk;walk;Lichtenvoorde-Groenlo;21:32:00;Lievelde, Erve Kots;21:32:00
bus 72 (Neede - Lichtenvoorde);Neede via Lievelde;Lievelde, Erve Kots;21:32:00;Groenlo, d' Orangie;21:38:00
walk;walk;Groenlo, d' Orangie;22:07:00;Groenlo, De Molenberg;22:07:00
Repeating search with reversed request: 
-- Router Request --
from:  Zutphen, De Martinet [3]
to:    Groenlo, De Molenberg [2]
date:  2013-07-23
time:  20:55:00 [1374605700]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 2
max time:  04:30:28 +1D
ERROR: transferring from unreached stop.
A 3 VEHICLES 
walk;walk;Zutphen, De Martinet;20:55:00;Zutphen, Rijkenhage;20:55:00
bus 82 (Zutphen - Doetinchem);Doetinchem via Steenderen;Zutphen, Rijkenhage;21:16:00;Doetinchem, Station;22:00:00
walk;walk;Doetinchem, Station;22:00:00;Doetinchem, Station;22:00:00
bus 74 (Enschede - Doetinchem);Haaksbergen Busstation;Doetinchem, Station;22:09:00;Lichtenvoorde, Twenteroute;22:39:00
bus 72 (Neede - Lichtenvoorde);Groenlo via Lievelde;Lichtenvoorde, Twenteroute;22:50:00;Groenlo, d' Orangie;23:08:00
walk;walk;Groenlo, d' Orangie;23:08:00;Groenlo, De Molenberg;23:08:00
----------------------------------------

A 3 VEHICLES 
walk;walk;Zutphen, De Martinet;20:55:00;Zutphen, Rijkenhage;20:55:00
bus 82 (Zutphen - Doetinchem);Doetinchem via Steenderen;Zutphen, Rijkenhage;21:16:00;Doetinchem, Station;22:00:00
walk;walk;Doetinchem, Station;22:00:00;Doetinchem, Station;22:00:00
bus 74 (Enschede - Doetinchem);Haaksbergen Busstation;Doetinchem, Station;22:09:00;Lichtenvoorde, Twenteroute;22:39:00
bus 72 (Neede - Lichtenvoorde);Groenlo via Lievelde;Lichtenvoorde, Twenteroute;22:50:00;Groenlo, d' Orangie;23:08:00
walk;walk;Groenlo, d' Orangie;23:08:00;Groenlo, De Molenberg;23:08:00

running MMRI tests in bliksem

MMRI tests are important for us to check if the router works as expected. At this moment the break the router. Need to get the super simple networks to work.

Reversal routing and (transitive/symetric) transfers

Currently our planner has issues with unidirectional transfers, because it can not do the reverse search without having the reverse transfer available. We should figure out if our transfers should in general be transitive, if not: generate both as workaround, or design a way to scan through all transfers.

Transfers are unidirectional, currently(?) rrr uses from_stop_id wrongly when reversing a search request.

master segfault

(gdb) bt
#0 0x000000000040336b in router_result_dump (prouter=0x7fffffffdc30, preq=0x7fffffffbcb0,

buf=0x7fffffffbce0 "\nA 1 VEHICLES \nwalk;walk;\020;11:41:24;Purmerend, Vurige Staart;17:38:56\n", 
buflen=8000) at router.c:363

#1 0x0000000000404a90 in main (argc=1, argv=0x7fffffffde98) at worker.c:68

(gdb) list
358 continue;
359 b += sprintf (b, "\nA %d VEHICLES \n", round_outer + 1);
360 int round = round_outer;
361 while (round >= 0) {
362 states = router.states + router.tdata.n_stops * round;
363 if (states[s].time == UNREACHED) {
364 round -= 1;
365 b += sprintf (b, "%d UNREACHED \n", s);
366 continue;
367 }

2c: add parentstation relationships as transfers

transfers.txt are currently handled, but there is another case of data inside gtfs which tells something about transfers between stops.

  1. we could ignore stops were we have parent stops for
  2. we could add transfers between all stops in a parent stops [transitive]
  3. we could make a parent stop as special transfer [transitive]

timetable.py crashes on GTFS's with just one day of service.

feed covers 2014-01-01 -- 2014-01-01
Scanning service calendar to find the month with maximum service.
NOTE that this is not necessarily accurate and you can end up with sparse service in the chosen period.
Traceback (most recent call last):
File "timetable.py", line 66, in
start_date = find_max_service()
File "timetable.py", line 55, in find_max_service
max_date, max_n_services = max(enumerate(n_month), key = lambda x : x[1])

Overnight: Reversal on first day of timetable.dat goes wrong

When reversing a request departing at the first possible second in the timetable.dat, the reversal ends up in 1970

CONTEXT
n_stops: 2
n_routes: 1

STOPS
stop 0 at lat 0.000000 lon 0.000000
served by routes 0 
stop 1 at lat 0.000000 lon 0.000000
served by routes 0 

ROUTES
route 0
serves stops 0 1 

STOPIDS
stop 000 has id Stop 2a1 
stop 001 has id Stop 2a2 

ROUTEIDS, TRIPIDS
route 000 has id bus long and first trip id LEV1pL�R 
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  2014-01-01
time:  00:00:00 [1388530800]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 5
max time:     --   
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  2014-01-01
time:  00:00:00 [1388530800]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 5
max time:     --   

origin_time 00:00:00 

CONTEXT
n_stops: 2
n_routes: 1

STOPS
stop 0 at lat 0.000000 lon 0.000000
served by routes 0 
stop 1 at lat 0.000000 lon 0.000000
served by routes 0 

ROUTES
route 0
serves stops 0 1 

STOPIDS
stop 000 has id Stop 2a1 
stop 001 has id Stop 2a2 

ROUTEIDS, TRIPIDS
route 000 has id bus long and first trip id LEV1pL�R 
Initializing router state 
stop 0 was marked as updated 
  applying transfer at 0 (Stop 2a1) 
  flagging route 0 at stop 0
  route running

Router states:
Stop name [sindex]  round 0  round 1  round 2  round 3  round 4  round 5
 Stop 2a1 [     0] 00:00:00    --       --       --       --       --   

round 0
  route 0: bus long

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    stop  0 [0] 00:00:00 Stop 2a1
hit previously-reached stop 0

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    boarding trip 0 at 00:01:00 
    stop  1 [1]    --    Stop 2a2
    on board trip 0 considering time 00:03:00 
    setting stop to 00:03:00 
stop 1 was marked as updated 
  applying transfer at 1 (Stop 2a2) 
  flagging route 0 at stop 1
  route running
round 1
  route 0: bus long

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    stop  0 [0] 00:00:00 Stop 2a1
hit previously-reached stop 0

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000001

    board option 0 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 1 at 00:01:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 2 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    board option 3 at 00:05:00 -1D 
00000000000000000000000000000001
00000000000000000000000000000010

    boarding trip 0 at 00:01:00 
    stop  1 [1] 00:03:00 Stop 2a2
    on board trip 0 considering time 00:03:00 
    (no improvement)
round 2
round 3
round 4
round 5
State present at round 0 
-- Router State --
time:         00:03:00 
board time:   00:01:00 
back trip id: bus long 
back route:   0
back stop     0 
Repeating search with reversed request: 
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  1970-01-01
time:  00:03:00 [180]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 0
max time:  12:02:56 +1D
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  1970-01-01
time:  00:03:00 [180]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 0
max time:  12:02:56 +1D

origin_time 00:03:00 

CONTEXT
n_stops: 2
n_routes: 1

STOPS
stop 0 at lat 0.000000 lon 0.000000
served by routes 0 
stop 1 at lat 0.000000 lon 0.000000
served by routes 0 

ROUTES
route 0
serves stops 0 1 

STOPIDS
stop 000 has id Stop 2a1 
stop 001 has id Stop 2a2 

ROUTEIDS, TRIPIDS
route 000 has id bus long and first trip id LEV1pL�R 
Initializing router state 
stop 1 was marked as updated 
  applying transfer at 1 (Stop 2a2) 
  flagging route 0 at stop 1

Router states:
Stop name [sindex]  round 0  round 1  round 2  round 3  round 4  round 5
 Stop 2a2 [     1] 00:03:00    --       --       --       --       --   

round 0
round 1
round 2
round 3
round 4
round 5
Repeating search with reversed request: 
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  1970-01-01
time:  00:03:00 [180]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 0
max time:  12:02:56 +1D
-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  1970-01-01
time:  00:03:00 [180]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 0
max time:  12:02:56 +1D

origin_time 00:03:00 

CONTEXT
n_stops: 2
n_routes: 1

STOPS
stop 0 at lat 0.000000 lon 0.000000
served by routes 0 
stop 1 at lat 0.000000 lon 0.000000
served by routes 0 

ROUTES
route 0
serves stops 0 1 

STOPIDS
stop 000 has id Stop 2a1 
stop 001 has id Stop 2a2 

ROUTEIDS, TRIPIDS
route 000 has id bus long and first trip id LEV1pL�R 
Initializing router state 
stop 1 was marked as updated 
  applying transfer at 1 (Stop 2a2) 
  flagging route 0 at stop 1

Router states:
Stop name [sindex]  round 0  round 1  round 2  round 3  round 4  round 5
 Stop 2a2 [     1] 00:03:00    --       --       --       --       --   

round 0
round 1
round 2
round 3
round 4
round 5

timeless transfers

I want to apply this one to timetable.py and RID.

diff --git a/timetable.py b/timetable.py
index 0e333d7..2d8a006 100755
--- a/timetable.py
+++ b/timetable.py
@@ -434,7 +434,10 @@ for from_idx, from_sid in enumerate(stop_id_for_idx) :
     transfers_offsets.append(offset)
     for from_sid, to_sid, ttype, ttime in db.execute(query, (from_sid,)) :
         if ttime == None :
-            continue # skip non-time/non-distance transfers for now
+            if ttype <= 2:
+                ttime = 0
+            else:
+                continue
         to_idx = idx_for_stop_id[to_sid]
         out.write(struct_If.pack(to_idx, float(ttime))) # must convert time/dist
         offset += 1

Overnight: test 1g IV fails.

Test 1g IV consist of a day which doesn't have service, and queries on that specific day. The result is very curious, it comes up with a time that is not even part of the schedule at all: 19:23:48.

-- Router Request --
from:  Stop 1g1 [0]
to:    Stop 1g2 [1]
date:  2014-01-02
time:  00:03:00 [1388617380]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 2
max time:     --   
Initializing router state 
stop 0 was marked as updated 
  applying transfer at 0 (Stop 1g1) 
  flagging route 0 at stop 0
  route running
Router states:
Stop name [sindex]  round 0  round 1  round 2
 Stop 1g1 [     0] 00:03:00    --       --   

round 0
  route 0: bus bus
    stop  0 [0] 00:03:00 Stop 1g1
hit previously-reached stop 0
00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000010

00000000000000000000000000000101
00000000000000000000000000000010

00000000000000000000000000000101
00000000000000000000000000000010

00000000000000000000000000000101
00000000000000000000000000000100

00000000000000000000000000000101
00000000000000000000000000000100

00000000000000000000000000000101
00000000000000000000000000000100

    boarding trip 0 at 00:01:00 +1D 
    stop  1 [1]    --    Stop 1g2
    setting stop to 00:02:00 +1D 
stop 1 was marked as updated 
  applying transfer at 1 (Stop 1g2) 
  flagging route 0 at stop 1
  route running
round 1
  route 0: bus bus
    stop  0 [0] 00:03:00 Stop 1g1
hit previously-reached stop 0
00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000001

00000000000000000000000000000101
00000000000000000000000000000010

00000000000000000000000000000101
00000000000000000000000000000010

00000000000000000000000000000101
00000000000000000000000000000010
00000000000000000000000000000101
00000000000000000000000000000100

00000000000000000000000000000101
00000000000000000000000000000100

00000000000000000000000000000101
00000000000000000000000000000100

    boarding trip 0 at 00:01:00 +1D 
    stop  1 [1] 00:02:00 +1D Stop 1g2
    (no improvement)
round 2

A 1 VEHICLES 
bus bus;Stop 1g1;1D;Stop 1g2;19:23:48 -1D

2b: Support trip attributes

Trip attributes such as wheelchair_accessible are now present GTFS. We need to design a way they can be used as hard dependency when planning.

Optimise the router for GUI use

Typically the user spends more time while looking up a stop than the planning process takes. The planner, as we speak, has a very bad cold performance (when the memory is not paged from disk). While the hot performance is very acceptable.

  • While typing the first stop, we could scan through the data file, and load the data in the background.
  • When the typing is done, we could already do the first step of the routing.
  • While typing the second stop, we could prime the results based on the distance (in time) from the first stop.
  • While typing the second stop, we could show the distance in time appended to the list.

flag_routes_for_stop segfault

Program received signal SIGSEGV, Segmentation fault.
0x080498e9 in flag_routes_for_stop (r=0xbfffcd70, stop_index=2083, date_mask=8)
at router.c:46
46 uint32_t route_active_flags = r->tdata.route_active[routes[i]];
(gdb) print i
$1 = 0
(gdb) p routes[0]
$2 = 74101
(gdb) p r->tdata.route_active
$3 = (uint32_t *) 0xf8f6f39f
(gdb)

I don't get yet where this fails, but this is generated with the bliksem integration platform.

Investigate slack-times for cross timingpoint transfers

Especially when adding timeupdates, we've got to investigate if setting slacktimes to nearly 0 if a transfer occurs from timingpoint to timingpoint within the same stoparea.
Usually it seems busses will wait on each other on timingpoints, not every later departure will be properly communicated via KV17.

trips file in the mmri file testset can't be loaded

skinkie@localhost ~/Sources/rrrr/qa/3e/tmp $ ../../../testerrrr --depart -D 2014-01-01T00:01:00 --from 0 --to 1 -T timetable.dat -g ../gtfs-rt/tripUpdates.dat
stop lat/lon out of range: lat=3.501000, lon=3.500000
stop lat/lon out of range: lat=3.502000, lon=3.500000
Indexing strings...

32bit compilation warnings

clang tdata.c -c -g -march=native -Wall -Wno-unused-function -Wno-unused-variable -O3  -o tdata.o
tdata.c:264:58: warning: format specifies type 'unsigned long' but the argument
      has type 'size_t' (aka 'unsigned int') [-Wformat]
    printf("Received feed message with %lu entities.\n", msg->n_entity);
                                       ~~~               ^~~~~~~~~~~~~
                                       %zu
1 warning generated.
clang util.c -c -g -march=native -Wall -Wno-unused-function -Wno-unused-variable -O3  -o util.o
clang json.c -c -g -march=native -Wall -Wno-unused-function -Wno-unused-variable -O3  -o json.o
json.c:257:30: warning: implicit conversion from 'long long' to 'long' changes
      value from 1376896831000 to -1787671016 [-Wconstant-conversion]
        json_kl("startTime", 1376896831000);
        ~~~~~~~              ^~~~~~~~~~~~~
json.c:258:28: warning: implicit conversion from 'long long' to 'long' changes
      value from 1376902021000 to -1782481016 [-Wconstant-conversion]
        json_kl("endTime", 1376902021000);
        ~~~~~~~            ^~~~~~~~~~~~~
json.c:305:29: warning: implicit conversion from 'long long' to 'long' changes
      value from 1376896320000 to -1788182016 [-Wconstant-conversion]
            json_kl("date", 1376896320000);
            ~~~~~~~         ^~~~~~~~~~~~~
3 warnings generated.
clang gtfs-realtime.pb-c.c -c -g -march=native -Wall -Wno-unused-function -Wno-unused-variable -O3  -o gtfs-realtime.pb-c.o
clang radixtree.c -c -g -march=native -Wall -Wno-unused-function -Wno-unused-variable -O3  -o radixtree.o
radixtree.c:291:39: warning: format specifies type 'long' but the argument has type 'unsigned int' [-Wformat]
    printf("size of one edge: %ld\n", sizeof(struct edge));
                              ~~~     ^~~~~~~~~~~~~~~~~~~
                              %u
radixtree.c:292:46: warning: format specifies type 'long' but the argument has type 'unsigned int' [-Wformat]
    printf("total size of all edges: %ld\n", edge_count(root) * sizeof(struct edge));
                                     ~~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     %u
2 warnings generated.
'''

Prettfy the router_result_dump

Normalisation was done in a naive way using a string buffer. Andrew has mentioned this can be done much more elegantly.

Planner forces me to walk to the next stop

Leidschendam, Rozenrust
Leiden, Korevaarstraat

19:30

Planner states that I have to walk for 18 minuten to the next stop. (I think I manage that it about 5) To catch a bus again 12 minutes later.

Modifying the time to 19:28 I get the bus at 19:30. (Probably the stop that is selected is the opposite side of the street).

Unpossible Itinerary crashes router

If you plan a trip that is really not possible, such as a trip between two unconnected islands crashes the router, there is no proper error handling

Validate we are timezone aware

With the current epoch code, we must validate that both inputs (timetable.dat and request) are timezone aware, and they don't have an offset of two hours.

Implement time demand groups in timetable.dat

We should have a way to write timedemandgroups / journeypatterns and public journeys in our timetable.dat.

Come up with a format (together with Andrew), writeout the files from our intergration database (instead of the GTFS way).

reversed search not symmetric

There is something asymmetric about forward/backward searches. The request reversal seems ok (note that the router is ignoring the transfer and time bounds for now) but the forward search gives a later arrival time than the one specified in the original arriveby search.

Searching with request: 
-- Router Request --
from:  Katwijk a/d Rijn, Callaoweg [6183]
to:    Zoetermeer, Pruimengaarde [5795]
time:  12:32:12 [45132]
speed: 1.500000 m/sec
arrive-by: true
max xfers: 4
max time:     --   
midnight: 00:00:00 -1D 
day mask: 00000000000000000000000010000000
includes: 7 
midnight: 00:00:00 
day mask: 00000000000000000000000100000000
includes: 8 
midnight: 00:00:00 +1D 
day mask: 00000000000000000000001000000000
includes: 9 
day mask: 00000000000000000000001110000000
includes: 7 8 9 

A 3 VEHICLES 
walk;walk;Katwijk a/d Rijn, Zanderijpad;11:16:00;Katwijk a/d Rijn, Callaoweg;11:12:52
bus 31 (Leiden - Katwijk via Noordboulevard);Leiden CS via Tramstraat;Leiden, Centraal Station;11:31:00;Katwijk a/d Rijn, Zanderijpad;11:16:00
walk;walk;Leiden, Centraal Station;11:33:00;Leiden, Centraal Station;11:31:28
bus 365 (Schiphol - Zoetermeer via Leiden);Zoetermeer via Leiden CS;Zoetermeer, Centrum West;11:59:00;Leiden, Centraal Station;11:33:00
walk;walk;Zoetermeer, Centrum West;12:02:00;Zoetermeer, Centrum West;12:01:56
bus 165 (Alphen a/d Rijn - Zoetermeer CW);Alphen a/d Rijn;Zoetermeer, Pruimengaarde;12:07:00;Zoetermeer, Centrum West;12:02:00

Repeating search with reversed request: 
-- Router Request --
from:  Katwijk a/d Rijn, Callaoweg [6183]
to:    Zoetermeer, Pruimengaarde [5795]
time:  11:12:48 [40368]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 2
max time:  12:32:12 -1D
midnight: 00:00:00 -1D 
day mask: 00000000000000000000000010000000
includes: 7 
midnight: 00:00:00 
day mask: 00000000000000000000000100000000
includes: 8 
midnight: 00:00:00 +1D 
day mask: 00000000000000000000001000000000
includes: 9 
day mask: 00000000000000000000001110000000
includes: 7 8 9 

A 3 VEHICLES 
bus 165 (Alphen a/d Rijn - Zoetermeer CW);Alphen a/d Rijn;Zoetermeer, Centrum West;13:02:00;Zoetermeer, Pruimengaarde;13:07:00
walk;walk;Zoetermeer, Centrum West;12:29:00;Zoetermeer, Centrum West;12:29:04
bus 365 (Schiphol - Zoetermeer via Leiden);Zoetermeer via Leiden CS;Leiden, Centraal Station;12:03:00;Zoetermeer, Centrum West;12:29:00
walk;walk;Leiden, Centraal Station;12:01:00;Leiden, Centraal Station;12:02:32
bus 31 (Leiden - Katwijk via Noordboulevard);Leiden CS via Tramstraat;Katwijk, Poolster;11:38:00;Leiden, Centraal Station;12:01:00
walk;walk;Noordwijk, Space Expo;11:31:00;Katwijk, Poolster;11:35:52
bus 30 (Leiden - Katwijk via Biltlaan);Katwijk via Biltlaan;Katwijk a/d Rijn, Molentuinweg;11:24:00;Noordwijk, Space Expo;11:31:00
walk;walk;Katwijk a/d Rijn, Callaoweg;11:12:48;Katwijk a/d Rijn, Molentuinweg;11:22:56

Filter too fast travels

OTP filters out super fast travels such as 2 stops in 0 seconds. We could just either throw these stops out or do a best effort interpolation based on distance.

Lelystad to Den Haag Moerwijk

When planning a trip from station Lelystad to Den Haag Moerwijk there is a direct train available at a very late time in the evening. In reversal this very late train is preferred over the arrival of the first search.

This might indicate some specific problem.

Best effort searches for long serviceless periods

Currently Bliksem is not able (by reverse search) to detect the last possible trip in the available timetable. I literally mean 'last', because if any other trip is available it will follow up on the next day.

What would be required is that the reverse search has some context, and is able to detect longer periods of no service. Hence it could also suggest: the last trip given the operating day was/is at XX:YY.

Additionally it may require the router te be informed if a trip should only search forwards (because the time is already passed) or should search 'around' a time.

longer trip from rrrr

reported by @skywave :

I have a significant longer route by bliksem when i compare it to 9292.

08:19 - 09:56 Lelystad Centrum Spoor 3 to Leeuwarden Spoor 4 [100-IC 21845|12|28623 richting Leeuwarden]
09:56 - 09:57 Leeuwarden Spoor 4 to Leeuwarden Spoor 8 [walk]
10:04 - 10:14 Leeuwarden Spoor 8 to Hurdegaryp Spoor 2 [500-ST 44159|2277|37425 richting Groningen]
10:14 - 10:16 Hurdegaryp Spoor 2 to Hurdegaryp, Stationsweg [walk]
10:18 - 10:23 Hurdegaryp, Stationsweg to Leeuwarden, Ouddeel [QBUZZ|f019 12|QBUZZ|OU_f019|53776|Week|f019|1022 richting Oosterwolde via Appelscha]
10:23 - 10:24 Leeuwarden, Ouddeel to Groene Ster, Ouddeel [walk]

http://9292.nl/reisadvies/station-lelystad-centrum/leeuwarden_bushalte-ouddeel/vertrek/2013-02-25T0819

It's 6 minutes longer and takes a different route (extra train section Leeuwarden->Hurdegaryp). Looking at the trip_id's, service_id maybe the cause. That extra train trip is was only valid in 2012.

first leg board time shifts

From @skinkie via email:
I just planned 16:55 from Voorburg, Voorburg Station to Rozenrust. It gives me the option to get on bus 45 to Leiden CS at 17:27. When I modify it to 16:54 my option changes to leaving at 17:12. I have to move it back to 16:39 to get the best departure at 16:57.

missing first leg

reported by @skinkie:

Try to do the following:

Den Helder Spoor 1 to Middelburg

It seems it skips the first route From Den Helder to Rotterdam but shows:
20116|29|12622 rtd|4 10:10:00 mdb|1 11:44:00

skinkie@eee ~/sources/bliksem/rrrr $ ./cmd-client.sh
From:
Den Helder Spoor 1 65391
To:
Middelburg Spoor 1rrrr[9870]: test client starting 65817
rrrr[9870]: test client number of requests: 1
rrrr[9870]: test client concurrency: 1
rrrr[9870]: test client thread will send 1 requests
rrrr[9870]: test client thread terminating
rrrr[9870]: 1 threads, 1 total requests, 0.177650 sec total time (5.629046 req/sec)
10:10 - 11:44 Rotterdam Centraal Spoor 4 to Middelburg Spoor 1 [100-IC 20116|29|12622 richting Vlissingen]

Trips across servicedays

If a transfer crosses a day, such as a nightbus at saturday 28:49:00 on to a early morning bus at sunday 06:30:00, this might increase the fare.

This ticket is here for two reasons
1 to remember to investigate the relevant business rules in both paper ticket as OVchipkaart regarding to this issue
2 And if so create an alert to notify the user of a possible higher fee.

/edit
Some businessrules
1 It is allowed to cross 4am but only if the trip start past midnight
2 Transfers across busses are okay when transfertime < 20 minutes

RRRR doesn't consider shorter time, fails test 2a1

Test 2a1 has four trips along the same route/journeypattern. In both cases there is a longer and shorter variant, the shorter variant departs later but always arrives at the destination first.
Ergo the router should always give an arrivaltime of 00:02:00 or 00:05:00.
When departing at 00:00:00 we expect to get a intinrary via 2a1|short|1 to arrive at 00:02:00, if that is not possible we expect a trip via 2a1|long|2 to arrive at 00:06:00

trips.txt
route_id,service_id,trip_id
2a1|short,ignore,2a1|short|1
2a1|short,ignore,2a1|short|2
2a1|long,ignore,2a1|long|1
2a1|long,ignore,2a1|long|2

stop_times.txt
trip_id,arrival_time,departure_time,stop_id,stop_sequence
2a1|long|1,00:01:00,00:01:00,2a1,1
2a1|long|1,00:03:00,00:03:00,2a2,2

2a1|short|1,00:01:00,00:01:00,2a1,1
2a1|short|1,00:02:00,00:02:00,2a2,2

2a1|long|2,00:05:00,00:05:00,2a1,1
2a1|long|2,00:06:00,00:06:00,2a2,2

2a1|short|2,00:05:00,00:05:00,2a1,1
2a1|short|2,00:07:00,00:07:00,2a2,2

NOTE: don't look at the route_id, which is set to the long because it 's the same route and we assign route_id per route.


CONTEXT
n_stops: 2
n_routes: 1

STOPS
stop 0 at lat 0.000000 lon 0.000000
served by routes 0 
stop 1 at lat 0.000000 lon 0.000000
served by routes 0 

ROUTES
route 0
serves stops 0 1 

STOPIDS
stop 000 has id Stop 2a1 
stop 001 has id Stop 2a2 

ROUTEIDS, TRIPIDS
route 000 has id bus long and first trip id LEV1���R 

-- Router Request --
from:  Stop 2a1 [0]
to:    Stop 2a2 [1]
date:  2014-01-01
time:  00:00:00 [1388530800]
speed: 1.500000 m/sec
arrive-by: false
max xfers: 5
max time:     --   

origin_time 00:00:00 
Initializing router state 
stop 0 was marked as updated 
  applying transfer at 0 (Stop 2a1) 
  flagging route 0 at stop 0
  route running

Router states:
Stop name [sindex]  round 0  round 1  round 2  round 3  round 4  round 5
 Stop 2a1 [     0] 00:00:00    --       --       --       --       --   

round 0
  route 0: bus long

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    stop  0 [0] 00:00:00 Stop 2a1
hit previously-reached stop 0

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    boarding trip 0 at 00:01:00 
    stop  1 [1]    --    Stop 2a2
    on board trip 0 considering time 00:03:00 
    setting stop to 00:03:00 
stop 1 was marked as updated 
  applying transfer at 1 (Stop 2a2) 
  flagging route 0 at stop 1
  route running
round 1
  route 0: bus long

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    stop  0 [0] 00:00:00 Stop 2a1
hit previously-reached stop 0

Route details for 'bus long' [0] (n_stops 2, n_trips 4)
stop sequence, stop name (index), departures  
   0                            Stop 2a1 [000000] : 00:01:00 -1D 00:01:00 -1D 00:05:00 -1D 00:05:00 -1D 
   1                            Stop 2a2 [000001] : 00:03:00 -1D 00:02:00 -1D 00:06:00 -1D 00:07:00 -1D 

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000010000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000000100000

    board option 0 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 1 at 00:01:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 2 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    board option 3 at 00:05:00 -1D 
00000000000000000000000000100000
00000000000000000000000001000000

    boarding trip 0 at 00:01:00 
    stop  1 [1] 00:03:00 Stop 2a2
    on board trip 0 considering time 00:03:00 
    (no improvement)
round 2
round 3
round 4
round 5

A 1 VEHICLES 
bus long;Stop 2a1;00:01:00;Stop 2a2;00:03:00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.