Improved A* time estimation
This commit is contained in:
parent
d68a7e5ca9
commit
e8331864ab
1 changed files with 5 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue