aded comments

This commit is contained in:
Lacroix Raphael 2022-05-28 14:21:59 +02:00
parent 60a9d2e296
commit d2a9172b7b
3 changed files with 9 additions and 3 deletions

View file

@ -48,12 +48,13 @@ public class Label implements Comparable<Label> {
}
public int compareTo(Label other) {
// compares the total cost
if (this.getTotalCost() < other.getTotalCost()) {
return -1;
} else {
if (this.getTotalCost() > other.getTotalCost()) {
return 1;
} else { // same total cost
} else { // same total cost ==> tie breaker : Crowcost
double thisCrowCost = this.getTotalCost()-this.getCost();
double otherCrowCost = other.getTotalCost()-other.getCost();

View file

@ -7,11 +7,13 @@ import org.insa.graphs.model.Node;
public class LabelStar extends Label{
private double crowCost;
private double crowCost; // used for the approximate crow distance
// we can either run the A* with respect to time or to distance hence the 2 separate constructors
public LabelStar(Node currNode, boolean marked, Arc father, Node dest, double maxSpeed){
super(currNode,marked,father);
this.crowCost = currNode.getPoint().distanceTo(dest.getPoint())/(maxSpeed*3.6);
this.crowCost = currNode.getPoint().distanceTo(dest.getPoint())/(maxSpeed*3.6);
}
public LabelStar(Node currNode, boolean marked, Arc father, Node dest){

View file

@ -201,6 +201,9 @@ public class Launch {
public static void main(String[] args) throws Exception {
// === these file are local the paths need to be adapted ===
// Due to the size of the files we chose not to include these in the git repository
// Visit these directory to see the list of available files on Commetud.
//final String mapName = "/home/rlacroix/Bureau/3MIC/Be Graphe/mapinsa/insa.mapgr";
//final String mapName = "/home/rlacroix/Bureau/3MIC/Be Graphe/mapinsa/carre-dense.mapgr";