change
This commit is contained in:
parent
c91585c90d
commit
f5d21db4aa
2 changed files with 6 additions and 8 deletions
|
@ -47,16 +47,14 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
for (Label l : List){
|
for (Label l : List){
|
||||||
if (l.getSommet()==y){
|
if (l.getSommet()==y){
|
||||||
if(!l.isMarque()){
|
if(!l.isMarque()){
|
||||||
double cout = l.getCost();
|
|
||||||
System.out.println("c = " + cout);
|
|
||||||
Boolean changé = false;
|
Boolean changé = false;
|
||||||
l.setCost(Math.min(l.getCost(), x.getCost()+suivant.getLength()));
|
if (x.getCost()+data.getCost(suivant) < l.getCost()){
|
||||||
System.out.println("l = " + l.getCost());
|
changé = true;
|
||||||
System.out.println("x = " + x.getCost());
|
}
|
||||||
if(cout != l.getCost()){
|
if(changé){
|
||||||
if (arcs.size() < i ){
|
if (arcs.size() < i ){
|
||||||
System.out.println("arc");
|
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);
|
arcs.remove(i-1);
|
||||||
}
|
}
|
||||||
Tas.insert(l);
|
Tas.insert(l);
|
||||||
|
@ -64,7 +62,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
|
||||||
arcs.add(suivant);
|
arcs.add(suivant);
|
||||||
l.setMarque(true);
|
l.setMarque(true);
|
||||||
}
|
}
|
||||||
|
l.setCost(Math.min(l.getCost(), x.getCost()+suivant.getLength()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue