Skip to content

Commit dbefd00

Browse files
Remove unused code from A*
1 parent 9c4d54b commit dbefd00

2 files changed

Lines changed: 0 additions & 49 deletions

File tree

application/src/main/java/org/opentripplanner/astar/AStar.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,6 @@ private void runSearch() {
194194
*/
195195
if (timeout != null && nVisited % 100 == 0 && System.currentTimeMillis() > abortTime) {
196196
LOG.warn("Search timeout. origin={} target={}", fromVertices, toVertices);
197-
// Rather than returning null to indicate that the search was aborted/timed out, we instead
198-
// set a flag in the SPT and return it anyway. This allows returning a partial list results
199-
// even when a timeout occurs.
200-
spt.setAborted();
201-
202197
break;
203198
}
204199

application/src/main/java/org/opentripplanner/astar/model/ShortestPathTree.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.opentripplanner.astar.model;
22

3-
import com.google.common.collect.HashMultiset;
4-
import com.google.common.collect.Multiset;
53
import java.util.ArrayList;
64
import java.util.Collection;
75
import java.util.Collections;
@@ -15,8 +13,6 @@
1513
import org.opentripplanner.astar.spi.AStarState;
1614
import org.opentripplanner.astar.spi.AStarVertex;
1715
import org.opentripplanner.astar.spi.DominanceFunction;
18-
import org.slf4j.Logger;
19-
import org.slf4j.LoggerFactory;
2016

2117
/**
2218
* This class keeps track which graph vertices have been visited and their associated states, so
@@ -40,15 +36,10 @@ public class ShortestPathTree<
4036
Vertex extends AStarVertex<State, Edge, Vertex>
4137
> {
4238

43-
private static final Logger LOG = LoggerFactory.getLogger(ShortestPathTree.class);
44-
4539
public final DominanceFunction<State> dominanceFunction;
4640

4741
private final Map<Vertex, List<State>> stateSets;
4842

49-
/** Indicates that the search timed out or was otherwise aborted. */
50-
private boolean aborted = false;
51-
5243
public ShortestPathTree(DominanceFunction<State> dominanceFunction) {
5344
this.dominanceFunction = dominanceFunction;
5445
// Initialized with a reasonable size, see #4445
@@ -80,37 +71,6 @@ public GraphPath<State, Edge, Vertex> getPath(Vertex dest) {
8071
}
8172
}
8273

83-
/** Print out a summary of the number of states and vertices. */
84-
public void dump() {
85-
Multiset<Integer> histogram = HashMultiset.create();
86-
int statesCount = 0;
87-
int maxSize = 0;
88-
for (Map.Entry<Vertex, List<State>> kv : stateSets.entrySet()) {
89-
List<State> states = kv.getValue();
90-
int size = states.size();
91-
histogram.add(size);
92-
statesCount += size;
93-
if (size > maxSize) {
94-
maxSize = size;
95-
}
96-
}
97-
LOG.info(
98-
"SPT: vertices: " +
99-
stateSets.size() +
100-
" states: total: " +
101-
statesCount +
102-
" per vertex max: " +
103-
maxSize +
104-
" avg: " +
105-
((statesCount * 1.0) / stateSets.size())
106-
);
107-
List<Integer> nStates = new ArrayList<>(histogram.elementSet());
108-
Collections.sort(nStates);
109-
for (Integer nState : nStates) {
110-
LOG.info("{} states: {} vertices.", nState, histogram.count(nState));
111-
}
112-
}
113-
11474
public Set<Vertex> getVertices() {
11575
return stateSets.keySet();
11676
}
@@ -240,10 +200,6 @@ public Collection<State> getAllStates() {
240200
return allStates;
241201
}
242202

243-
public void setAborted() {
244-
aborted = true;
245-
}
246-
247203
public String toString() {
248204
return "ShortestPathTree(" + this.stateSets.size() + " vertices)";
249205
}

0 commit comments

Comments
 (0)