Browse Source

pb ouvert-ready

Favary Pierre 2 years ago
parent
commit
96d19c91e8

+ 14
- 5
be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java View File

@@ -2,7 +2,9 @@
2 2
 	
3 3
 	import org.insa.graphs.algorithm.AbstractSolution.Status;
4 4
 	import org.insa.graphs.algorithm.utils.BinaryHeap;
5
-	import org.insa.graphs.model.Arc;
5
+import org.insa.graphs.model.AccessRestrictions.AccessMode;
6
+import org.insa.graphs.model.AccessRestrictions.AccessRestriction;
7
+import org.insa.graphs.model.Arc;
6 8
 import org.insa.graphs.model.Node;
7 9
 	import org.insa.graphs.model.Path;
8 10
 	import java.util.ArrayList;
@@ -31,6 +33,8 @@ import org.insa.graphs.model.Node;
31 33
 	    	
32 34
 	    	this.nbnodes=0;
33 35
 	    	
36
+	    	int mul=1;//problème ouvert
37
+	    	
34 38
 	        final ShortestPathData data = getInputData();
35 39
 	        ShortestPathSolution solution = new ShortestPathSolution(data,Status.UNKNOWN);//modifié
36 40
 	        
@@ -75,17 +79,22 @@ import org.insa.graphs.model.Node;
75 79
 		        		y=arcy.getDestination().getId();
76 80
 		        		//System.out.println(tas.isValid());
77 81
 		        		
78
-		        		if (!tablabel[y].marque && data.isAllowed(arcy)) {//ligne 108 de l'excel d'avancement
82
+		        		if (!tablabel[y].marque && data.isAllowed(arcy)) {
79 83
 		        			
80
-		        			if (tablabel[y].getCost()>tablabel[x].getCost()+(float)data.getCost(arcy)) {
84
+		        			if (arcy.getRoadInformation().getAccessRestrictions().isAllowedFor(AccessMode.MOTORCAR,
85
+		        					AccessRestriction.ALLOWED))
86
+		        				mul=1;
87
+		        			else//ce bloc sert à l'implémentation du problème ouvert
88
+		        				mul=1;
89
+		        			if (tablabel[y].getCost()>tablabel[x].getCost()+mul*(float)data.getCost(arcy)) {
81 90
 		        				
82 91
 		        				if (tablabel[y].getCost()!=Float.MAX_VALUE) {
83 92
 		        					tas.remove(tablabel[y]);
84 93
 		        					this.notifyNodeReached(arcy.getDestination());
85 94
 		        				}
86 95
 		        				
87
-		        				tablabel[y].cout=tablabel[x].getCost()+(float)data.getCost(arcy);
88
-		        				tablabel[y].pere=arcy;//ligne non dans le poly
96
+		        				tablabel[y].cout=tablabel[x].getCost()+mul*(float)data.getCost(arcy);
97
+		        				tablabel[y].pere=arcy;
89 98
 		        				tas.insert(tablabel[y]);
90 99
 		        				
91 100
 		        			}

Loading…
Cancel
Save