LabelStar conmencé

This commit is contained in:
Fu Boyu 2023-04-21 09:39:05 +02:00
parent e32fb51fa4
commit 39ea623f84
2 changed files with 35 additions and 1 deletions

View file

@ -56,10 +56,19 @@
{
this.currentNode = currentNode;
}
public double getTotalCost()
{
return this.getCost();
}
public int compareTo(Label label)
{
return Double.compare(getCost(), label.getCost());
int i = Double.compare(this.getTotalCost(), label.getTotalCost());
if (i == 0){
i = Double.compare(label.getCost(), this.getCost());
}
return i;
}
}

View file

@ -0,0 +1,25 @@
package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.model.*;
public class LabelStar extends Label {
private double CostEstime;
public LabelStar(Node node){
super(node);
this.CostEstime = Double.POSITIVE_INFINITY ;
}
public double getCostEstime(){
return CostEstime;
}
public void setCostEstime(double CostEstime){
this.CostEstime = CostEstime;
}
@Override
public double getTotalCost(){
return super.getCost() + getCostEstime();
}
}