Skip to content

Commit 0d8a216

Browse files
committed
Remove pareto-optimality check of via connections
The check had really bad performance and non-pareto optimal results don't cause that much problems
1 parent 3d8dbaf commit 0d8a216

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,10 @@ private List<RaptorViaConnection> validateConnections(List<BuilderStopAndTransfe
138138
if (connections.isEmpty()) {
139139
throw new IllegalArgumentException("At least one connection is required.");
140140
}
141-
var list = connections
141+
return connections
142142
.stream()
143143
.map(it -> RaptorViaConnection.of(this, it.fromStop, it.transfer))
144144
.toList();
145-
146-
// Compare all pairs to check for duplicates and non-optimal connections
147-
for (int i = 0; i < list.size(); ++i) {
148-
var a = list.get(i);
149-
for (int j = i + 1; j < list.size(); ++j) {
150-
var b = list.get(j);
151-
if (a.isBetterOrEqual(b) || b.isBetterOrEqual(a)) {
152-
throw new IllegalArgumentException(
153-
"All connection need to be pareto-optimal: (" + a + ") <-> (" + b + ")"
154-
);
155-
}
156-
}
157-
}
158-
return list;
159145
}
160146

161147
public abstract static sealed class AbstractBuilder<T extends AbstractBuilder> {

0 commit comments

Comments
 (0)