ajustement ProblemeOuvert à tête reposée (quelques félonies ont été effectuées dans le code d'avant, normalement il y en a moins dans celui-ci)
Этот коммит содержится в:
родитель
d6bd57d709
коммит
b89e741861
2 изменённых файлов: 13 добавлений и 12 удалений
|
|
@ -15,7 +15,7 @@ import org.insa.graphs.model.RoadInformation.RoadType;
|
|||
public class ProblemeOuvert extends DijkstraAlgorithm {
|
||||
|
||||
|
||||
private double MAX_BATTERY = 200;
|
||||
private double MAX_BATTERY = 200000; //on compare avec lenght ça doit être des mètres
|
||||
|
||||
public ProblemeOuvert(ShortestPathData data) {
|
||||
super(data);
|
||||
|
|
@ -105,7 +105,7 @@ public class ProblemeOuvert extends DijkstraAlgorithm {
|
|||
double batteryLeft = ((LabelProblemeOuvert) LabelActuel).getAutonomieRestante();
|
||||
|
||||
double newCost = LabelActuel.getCoutRealise() + arcCost;
|
||||
|
||||
/*
|
||||
if (newCost < succLabel.getCoutRealise()) {
|
||||
if (succLabel.getCoutRealise() != Double.POSITIVE_INFINITY) {
|
||||
heap.remove(succLabel);
|
||||
|
|
@ -113,7 +113,7 @@ public class ProblemeOuvert extends DijkstraAlgorithm {
|
|||
}
|
||||
succLabel.setCoutRealise(newCost);
|
||||
succLabel.setPere(arc);
|
||||
succLabel.setAutonomieRestante(batteryLeft);
|
||||
succLabel.setAutonomieRestante(batteryLeft); //pb on updatais pas la batterie
|
||||
predecessorArcs[succ.getId()] = arc;
|
||||
|
||||
// Insertion dans le tas car on est sûr qu'il n'est pas
|
||||
|
|
@ -142,28 +142,29 @@ public class ProblemeOuvert extends DijkstraAlgorithm {
|
|||
|
||||
notifyNodeReached(succ);
|
||||
//}
|
||||
}
|
||||
}*/
|
||||
//if (arc.getLength()>200000){continue;} //sécurité
|
||||
|
||||
/*
|
||||
if (batteryLeft < arcCost) { //si nous n'avons pas assez de batterie pour l'arc
|
||||
|
||||
if (batteryLeft < arc.getLength()) { //si nous n'avons pas assez de batterie pour l'arc
|
||||
// Recharge possible uniquement sur autoroute
|
||||
if (arc.getRoadInformation().getType() == RoadType.MOTORWAY) {
|
||||
double rechargeCost = newCost + 120; // 2 minutes de recharge
|
||||
//if (rechargeCost < succLabel.getCoutRealise()) {
|
||||
if (rechargeCost < succLabel.getCoutRealise()) {
|
||||
if (succLabel.getCoutRealise() != Double.POSITIVE_INFINITY) {
|
||||
heap.remove(succLabel);
|
||||
}
|
||||
succLabel.setCoutRealise(rechargeCost);
|
||||
succLabel.setPere(arc);
|
||||
succLabel.setAutonomieRestante(MAX_BATTERY);
|
||||
succLabel.setAutonomieRestante(MAX_BATTERY-arc.getLength());
|
||||
predecessorArcs[succ.getId()] = arc;
|
||||
heap.insert(succLabel);
|
||||
notifyNodeReached(succ);
|
||||
//}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Assez de batterie
|
||||
double newBatteryLeft = batteryLeft - arcCost;
|
||||
double newBatteryLeft = batteryLeft - arc.getLength(); //avant on faisait arcCost mais qui était en temps (on fait tous nos test en temps)
|
||||
if (newCost < succLabel.getCoutRealise()) {
|
||||
if (succLabel.getCoutRealise() != Double.POSITIVE_INFINITY) {
|
||||
heap.remove(succLabel);
|
||||
|
|
@ -175,7 +176,7 @@ public class ProblemeOuvert extends DijkstraAlgorithm {
|
|||
heap.insert(succLabel);
|
||||
notifyNodeReached(succ);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Загрузка…
Сослаться в новой задаче