This commit is contained in:
Bensouda Idriss 2023-04-19 14:03:59 +02:00
parent c91585c90d
commit f5d21db4aa
2 changed files with 6 additions and 8 deletions

View file

@ -47,16 +47,14 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
for (Label l : List){
if (l.getSommet()==y){
if(!l.isMarque()){
double cout = l.getCost();
System.out.println("c = " + cout);
Boolean changé = false;
l.setCost(Math.min(l.getCost(), x.getCost()+suivant.getLength()));
System.out.println("l = " + l.getCost());
System.out.println("x = " + x.getCost());
if(cout != l.getCost()){
if (x.getCost()+data.getCost(suivant) < l.getCost()){
changé = true;
}
if(changé){
if (arcs.size() < i ){
System.out.println("arc");
}else if (cout < arcs.get(i-1).getLength()){
}else if (l.getCost() < arcs.get(i-1).getLength()){
arcs.remove(i-1);
}
Tas.insert(l);
@ -64,7 +62,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
arcs.add(suivant);
l.setMarque(true);
}
l.setCost(Math.min(l.getCost(), x.getCost()+suivant.getLength()));
}
}
}