public override List <GenericNode> GetListSucc() { List <GenericNode> lsucc = new List <GenericNode>(); for (int i = 0; i < DijkstraAForm.nbNodes; i++) { if (DijkstraAForm.matrice[numero, i] != -1) { SpecificNode newnode2 = new SpecificNode(); newnode2.numero = i; lsucc.Add(newnode2); } } return(lsucc); }
/* Résolution du graphe */ private void DijkstraASolverIterationDefiner() { this.g = new SearchTree(); SpecificNode N0 = new SpecificNode(); N0.numero = numInitial; //Algorithme de Dijkstra A* dans la classe SearchTree List <GenericNode> solution = g.RechercheSolutionAEtoile(N0, this); //Enregistrement de la solution finale à l'algorithme du chemin le plus court dans le Form de réponses SpecificNode N1 = N0; for (int i = 1; i < solution.Count; i++) { SpecificNode N2 = (SpecificNode)solution[i]; answersForm.AddLbDijkstraSolvedItem(((char)(N1.numero + 65)).ToString() + " ---> " + ((char)(N2.numero + 65)).ToString() + " : " + Convert.ToString(matrice[N1.numero, N2.numero])); N1 = N2; } //Enregistrement de l'arbre final de l'algorithme dans le Form de réponses this.g.GetSearchTree(answersForm.GetTv(), true); this.g.GetSearchTree(tv_input, false); //Enregistrement des réponses (fermés et ouverts) à chaque étape de l'algorithme à la main de Dijkstra dans le Form de réponses string txt; for (int i = 0; i < this.g.L_FermesEvolution.Count; i++) { txt = "(" + (i + 1).ToString() + ") : { "; foreach (string el in this.g.L_FermesEvolution[i]) { txt += (el + " "); } txt += "}"; answersForm.AddLbFermesGrapheItem(txt); } for (int i = 0; i < this.g.L_OuvertsEvolution.Count; i++) { txt = "(" + (i + 1).ToString() + ") : { "; foreach (string el in this.g.L_OuvertsEvolution[i]) { txt += (el + " "); } txt += "}"; answersForm.AddLbOuvertsGrapheItem(txt); } }
public override double GetArcCost(GenericNode N2) { SpecificNode N2bis = (SpecificNode)N2; return(DijkstraAForm.matrice[numero, N2bis.numero]); }
// Méthodes abstraites, donc à surcharger obligatoirement avec override dans une classe fille public override bool IsEqual(GenericNode N2) { SpecificNode N2bis = (SpecificNode)N2; return(numero == N2bis.numero); }