Compare commits
No commits in common. "ac18c2d52266633ea8a620de56db073aabc7c439" and "d68a7e5ca93c679ce46f66610a018bb7f3850909" have entirely different histories.
ac18c2d522
...
d68a7e5ca9
2 changed files with 27 additions and 22 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
package org.insa.graphs.algorithm.shortestpath;
|
package org.insa.graphs.algorithm.shortestpath;
|
||||||
|
|
||||||
|
import org.insa.graphs.algorithm.AbstractInputData;
|
||||||
import org.insa.graphs.model.Graph;
|
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 {
|
public class AStarAlgorithm extends DijkstraAlgorithm {
|
||||||
|
|
||||||
|
|
@ -19,7 +23,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
|
||||||
final double distance = graph.getNodes().get(i).getPoint().distanceTo(
|
final double distance = graph.getNodes().get(i).getPoint().distanceTo(
|
||||||
data.getDestination().getPoint()
|
data.getDestination().getPoint()
|
||||||
);
|
);
|
||||||
final double maxSpeed = graph.getGraphInformation().getMaximumSpeed();
|
final double maxSpeed = data.getMaximumSpeed();
|
||||||
double estimatedCost = distance;
|
double estimatedCost = distance;
|
||||||
if (data.getMode() == ShortestPathData.Mode.TIME)
|
if (data.getMode() == ShortestPathData.Mode.TIME)
|
||||||
estimatedCost /= maxSpeed;
|
estimatedCost /= maxSpeed;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public abstract class AlgoTest {
|
||||||
protected ArrayList<PathDataset> invalidTestData;
|
protected ArrayList<PathDataset> invalidTestData;
|
||||||
|
|
||||||
// Graphs to use
|
// Graphs to use
|
||||||
private Graph graphInsa, graphSquare, graphBretagne, graphGuadeloupe;
|
private Graph graphInsa, graphSquare, graphBretagne;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to store all data related to a path and its computed solutions
|
* Class used to store all data related to a path and its computed solutions
|
||||||
|
|
@ -129,7 +129,6 @@ public abstract class AlgoTest {
|
||||||
graphInsa = readGraph("../Maps/insa.mapgr");
|
graphInsa = readGraph("../Maps/insa.mapgr");
|
||||||
graphSquare = readGraph("../Maps/carre.mapgr");
|
graphSquare = readGraph("../Maps/carre.mapgr");
|
||||||
graphBretagne = readGraph("../Maps/bretagne.mapgr");
|
graphBretagne = readGraph("../Maps/bretagne.mapgr");
|
||||||
graphGuadeloupe = readGraph("../Maps/guadeloupe.mapgr");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -140,23 +139,20 @@ public abstract class AlgoTest {
|
||||||
filterTime = ArcInspectorFactory.getAllFilters().get(2);
|
filterTime = ArcInspectorFactory.getAllFilters().get(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathDataset getNewPathDataset(Graph graph, int originID, int destinationID) {
|
|
||||||
return new PathDataset(
|
|
||||||
graph,
|
|
||||||
graph.getNodes().get(originID),
|
|
||||||
graph.getNodes().get(destinationID)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates valid data sets
|
* Creates valid data sets
|
||||||
*/
|
*/
|
||||||
private void initValidPathList() {
|
private void initValidPathList() {
|
||||||
validTestData = new ArrayList<>();
|
validTestData = new ArrayList<>();
|
||||||
|
|
||||||
validTestData.add(getNewPathDataset(graphInsa, 512, 526));
|
validTestData.add(new PathDataset(
|
||||||
validTestData.add(getNewPathDataset(graphGuadeloupe, 12822, 13687));
|
graphInsa,
|
||||||
validTestData.add(getNewPathDataset(graphSquare, 21, 17));
|
graphInsa.getNodes().get(512),
|
||||||
|
graphInsa.getNodes().get(526)));
|
||||||
|
validTestData.add(new PathDataset(
|
||||||
|
graphSquare,
|
||||||
|
graphSquare.getNodes().get(21),
|
||||||
|
graphSquare.getNodes().get(17)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -165,10 +161,15 @@ public abstract class AlgoTest {
|
||||||
private void initInvalidPathList() {
|
private void initInvalidPathList() {
|
||||||
invalidTestData = new ArrayList<>();
|
invalidTestData = new ArrayList<>();
|
||||||
|
|
||||||
invalidTestData.add(getNewPathDataset(graphBretagne, 29270, 545599));
|
invalidTestData.add(new PathDataset(
|
||||||
invalidTestData.add(getNewPathDataset(graphGuadeloupe, 26963, 4307));
|
graphBretagne,
|
||||||
invalidTestData.add(getNewPathDataset(graphGuadeloupe, 8185, 8185));
|
graphBretagne.getNodes().get(29270),
|
||||||
invalidTestData.add(getNewPathDataset(graphSquare, 10, 10));
|
graphBretagne.getNodes().get(545599)));
|
||||||
|
|
||||||
|
invalidTestData.add(new PathDataset(
|
||||||
|
graphSquare,
|
||||||
|
graphSquare.getNodes().get(10),
|
||||||
|
graphSquare.getNodes().get(10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue