Dikjstra et A*
This commit is contained in:
		
							parent
							
								
									d867c0db7f
								
							
						
					
					
						commit
						018d321be4
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -19,6 +19,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm { | |||
|         for (int i=0;i<n;i++){ | ||||
|             tab.add(new LabelStar(data.getGraph().get(i), false, Double.POSITIVE_INFINITY , null,data.getGraph().get(i).getPoint().distanceTo(destination))); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,12 +6,13 @@ import org.insa.graphs.model.Path; | |||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import org.insa.graphs.model.Point; | ||||
| 
 | ||||
| import org.insa.graphs.algorithm.utils.BinaryHeap; | ||||
| 
 | ||||
| public class DijkstraAlgorithm extends ShortestPathAlgorithm { | ||||
|     /*initialisation */ | ||||
|     void init(ArrayList<Label> tab){ | ||||
|     void init(ArrayList<Label> tab, Point destination){ | ||||
|         /*nombre de nodes du graphe de data */ | ||||
|         int n=data.getGraph().size(); | ||||
|         /*on remplit tab */ | ||||
|  | @ -30,7 +31,8 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm { | |||
|         ArrayList<Label> tab=new ArrayList<Label>(); | ||||
|         BinaryHeap<Label> tas=new BinaryHeap<Label>(); | ||||
|         ShortestPathSolution solution = null; | ||||
|         init(tab); | ||||
|         /*initialisation */ | ||||
|         init(tab,data.getDestination().getPoint()); | ||||
|         Label label_origine = tab.get(data.getOrigin().getId()); | ||||
|         label_origine.setCoutmin(0); | ||||
|         Label label_dest =tab.get(data.getDestination().getId()); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue