Assertion `id < tripstops.size()' failed

0 views
Skip to first unread message

mikenz

unread,
Jul 6, 2009, 6:45:55 PM7/6/09
to libroutez
Hi,

I'm getting the following error - find_path debugging turned on:

dev3:/home/mikenz/libroutez# examples/testpython.py
Find path. Secs: 0 service period: weekday walkonly: 0 src lat:
-36.844937 src lng: 174.766511 dest_lat: -36.881697 dest_lng:
174.784211
- Start: 304897 End: 117297
- Start time - 15
Continuing
Extending path at vertex 304897 (on -1) @ 15.000000 (walktime:
0.000000, routetime:0.000000)
- Considering walkpath to 304891
-- Adding walkpath to 304891
python: lib/tripgraph.cc:423: boost::shared_ptr<TripStop>
TripGraph::_get_tripstop(int32_t): Assertion `id < tripstops.size()'
failed.
Aborted
dev3:/home/mikenz/libroutez#

Any suggestions on where to start looking? I'm going to try simplify
the dataset to see if there's something specific in there that causes
it.

- Mike

Mike Cochrane

unread,
Jul 6, 2009, 7:30:05 PM7/6/09
to libr...@googlegroups.com
Simple fix:

dev3:/home/mikenz/libroutez# git diff -w lib
diff --git a/lib/tripgraph.cc b/lib/tripgraph.cc
old mode 100644
new mode 100755
index 0f8a610..4e8bfd4
--- a/lib/tripgraph.cc
+++ b/lib/tripgraph.cc
@@ -87,7 +87,6 @@ void TripGraph::load(string fname)
shared_ptr<TripStop> s(new TripStop(fp));
assert(tripstops.size() == s->id);
tripstops.push_back(s);
- i++;
}

fclose(fp);
dev3:/home/mikenz/libroutez#

i was getting incremented in the for and inside the loop so it was only
loading half the trip stops (every second one) from the file.

- Mike

William Lachance

unread,
Jul 12, 2009, 11:59:42 AM7/12/09
to libr...@googlegroups.com
2009/7/6 Mike Cochrane <mi...@mikenz.geek.nz>:

> i was getting incremented in the for and inside the loop so it was only
> loading half the trip stops (every second one) from the file.

Hi Matt,

You did indeed hit a bug (and provided the right fix). I actually
found the same thing earlier in the week, but neglected to push/commit
my changes. I added a unit test for this case so it won't happen
again.

Thanks for your interest in libroutez! It's good to see someone using
it for one of their own projects.
--
William Lachance
wrl...@gmail.com

Reply all
Reply to author
Forward
0 new messages