Skip to content

Commit 11d6892

Browse files
Add documentation of filter
1 parent 117b4c2 commit 11d6892

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

application/src/main/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/group/RemoveOtherThanSameLegsMaxGeneralizedCost.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@
1717
* itineraries have a much higher cost for the other legs. This is similar to {@link
1818
* org.opentripplanner.routing.algorithm.filterchain.filters.transit.TransitGeneralizedCostFilter},
1919
* but is used together with {@link GroupByFilter} to filter within the groups.
20+
*
21+
* <h3>Example</h3>
22+
*
23+
* Lets give 5% slack: f=1.05
24+
*
25+
* <pre>
26+
* Itin A: | ### cost of legs common trips - $42 ### | ########## other legs - $41 ########## | (Total: $83)
27+
* Itin B: | ######## cost of legs common trips - $52 ######## | ### other legs - $27 ### | (Total: $79)
28+
* </pre>
29+
*
30+
* <ul>
31+
* <li>Min cost common legs: a=$42</li>
32+
* <li>Min cost all itineraries: b=$79</li>
33+
* <li>maxLimit = a + (b - a) * f = 42 + 37 * 1.05 = 81</li>
34+
* <li><b>Result:</b> Keep itinerary A, and drop B ($83 > limit $81)</li>
35+
* </ul>
2036
*/
2137
public class RemoveOtherThanSameLegsMaxGeneralizedCost implements RemoveItineraryFlagger {
2238

0 commit comments

Comments
 (0)