Improved A* time estimation
这个提交包含在:
父节点
d68a7e5ca9
当前提交
e8331864ab
共有 1 个文件被更改,包括 5 次插入 和 9 次删除
|
|
@ -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,11 +19,11 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
|
|||
final double distance = graph.getNodes().get(i).getPoint().distanceTo(
|
||||
data.getDestination().getPoint()
|
||||
);
|
||||
final double maxSpeed = data.getMaximumSpeed();
|
||||
double estimatedCost = distance;
|
||||
if (data.getMode() == ShortestPathData.Mode.TIME)
|
||||
estimatedCost /= maxSpeed;
|
||||
labels[i].setEstimatedCost(estimatedCost);
|
||||
final double maxSpeed = graph.getGraphInformation().getMaximumSpeed();
|
||||
double estimatedCost = distance;
|
||||
if (data.getMode() == ShortestPathData.Mode.TIME)
|
||||
estimatedCost /= maxSpeed;
|
||||
labels[i].setEstimatedCost(estimatedCost);
|
||||
}
|
||||
return this.doDijkstra(labels, data, graph);
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用