chore(time-trial): remove final ms count display
This commit is contained in:
parent
3f7a1543fd
commit
4c71453889
1 changed files with 10 additions and 20 deletions
|
@ -15,40 +15,30 @@ import org.insa.graphs.model.io.BinaryGraphReader;
|
|||
import org.insa.graphs.model.io.GraphReader;
|
||||
|
||||
public class RunTimeTrial {
|
||||
final static int TEST_COUNT = 100;
|
||||
final static int TEST_COUNT_PER_MAP = 100;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final Graph graph = readGraph("./Maps/midi-pyrenees.mapgr");
|
||||
|
||||
long totalDijkstraTime = 0;
|
||||
long totalAStarTime = 0;
|
||||
long totalBellmanTime = 0;
|
||||
System.err.println("N P D A B");
|
||||
|
||||
System.err.println("N D A B");
|
||||
|
||||
for (int i = 0; i < TEST_COUNT; i++) {
|
||||
//System.out.println("Running time trial " + i + "/" + TEST_COUNT);
|
||||
for (int i = 0; i < TEST_COUNT_PER_MAP; i++) {
|
||||
final ShortestPathData data = getRandomShortestPathData(graph);
|
||||
|
||||
ShortestPathSolution dijkstraSolution = new DijkstraAlgorithm(data).run();
|
||||
ShortestPathSolution aStarSolution = new AStarAlgorithm(data).run();
|
||||
//ShortestPathSolution bellmanSolution = new BellmanFordAlgorithm(data).run();
|
||||
|
||||
totalDijkstraTime += dijkstraSolution.getSolvingTime().toMillis();
|
||||
totalAStarTime += aStarSolution.getSolvingTime().toMillis();
|
||||
//totalBellmanTime += bellmanSolution.getSolvingTime().toMillis();
|
||||
|
||||
final int pathSize = dijkstraSolution.getPath() == null ? -1 : dijkstraSolution.getPath().getArcs().size();
|
||||
System.out.println(pathSize + " "
|
||||
+ dijkstraSolution.getSolvingTime().toMillis() + " "
|
||||
+ aStarSolution.getSolvingTime().toMillis() + " "
|
||||
//+ bellmanSolution.getSolvingTime().toMillis() + " "
|
||||
|
||||
System.out.println(
|
||||
graph.size() + " "
|
||||
+ pathSize + " "
|
||||
+ dijkstraSolution.getSolvingTime().toMillis() + " "
|
||||
+ aStarSolution.getSolvingTime().toMillis() + " "
|
||||
//+ bellmanSolution.getSolvingTime().toMillis() + " "
|
||||
);
|
||||
}
|
||||
|
||||
System.out.println("Dijkstra took " + totalDijkstraTime + " ms");
|
||||
System.out.println("A* took " + totalAStarTime + " ms");
|
||||
System.out.println("Bellman took " + totalBellmanTime + " ms");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue