Improved A* time estimation

This commit is contained in:
Arnaud Vergnet 2020-05-22 14:53:37 +02:00
parent d68a7e5ca9
commit e8331864ab

View file

@ -1,10 +1,6 @@
package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.algorithm.AbstractInputData;
import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Node;
import org.insa.graphs.model.Point;
import org.insa.graphs.model.RoadInformation;
public class AStarAlgorithm extends DijkstraAlgorithm {
@ -23,7 +19,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
final double distance = graph.getNodes().get(i).getPoint().distanceTo(
data.getDestination().getPoint()
);
final double maxSpeed = data.getMaximumSpeed();
final double maxSpeed = graph.getGraphInformation().getMaximumSpeed();
double estimatedCost = distance;
if (data.getMode() == ShortestPathData.Mode.TIME)
estimatedCost /= maxSpeed;