opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.2k stars 1.03k forks source link

Best Result Not Being Returned First #1796

Closed demory closed 4 years ago

demory commented 9 years ago

Sometime the fastest itinerary is not being returned first. Note the second result in this example:

http://trimet-new.dev.conveyal.com/?module=planner&fromPlace=45.29980542656,-122.77069645014&toPlace=45.379879699824,-122.2655217278&date=04-06-2015&maxWalkDistance=32187&mode=TRANSIT,BICYCLE&optimize=QUICK&time=4:20PM

trevorgerhardt commented 9 years ago

In this case, the shortest itinerary is being returned first. So setting "departing at" implies best would be the earliest arrival at the destination?

abyrd commented 9 years ago

At GraphPathFinder L188 the paths are sorted with a PathWeightComparator. So as @trevorgerhardt has hinted, it's the lowest weight path that comes first. According to the routing logic this is the "best" path, and if it doesn't seem like the "best" one then maybe the weights should be calibrated... If you want the earliest arrival solution first there is another comparator for that (PathComparator).