public Chemin(GestionnaireChemin gc) { this.gc = gc; this.chemin = gc.getVilles(); this.score = 0.0; this.distance = 0.0; }
public Algorithme(GestionnaireChemin gc) { this.tauxMutation = 0.015; this.tailleTournoi = 5; this.elitisme = true; this.gc = gc; }
public static void linqTest() { GestionnaireChemin gc = new GestionnaireChemin(); Chemin chemin = new Chemin(gc); Console.WriteLine("Evaluation du meilleur chemin, veuillez patienter ..."); // Initialisation de la population Population pop = new Population(NBPOPULATION, gc); //Console.WriteLine("Distance initiale = " + pop.getMeilleurChemin().getDistance()); // Evolution de la population sur 100 générations Algorithme ga = new Algorithme(gc); pop = ga.evoluerPopulation(pop); for (int i = 0; i < NBGENERATION; i++) { pop = ga.evoluerPopulation(pop); Console.WriteLine("Gen " + i + " : " + pop.getMeilleurChemin().getDistance()); } Console.WriteLine("Distance finale = " + pop.getMeilleurChemin().getDistance()); Chemin meilleurePopulation = pop.getMeilleurChemin(); }
public Population(int taillePopulation, GestionnaireChemin gc) { this.gc = gc; this.lesCheminsRetenus = new List <Chemin>(); for (int i = 0; i < taillePopulation; i++) { this.lesCheminsRetenus.Add(new Chemin(gc)); } this.taillePopulation = taillePopulation; }
public GestionnaireChemin initialiseChemins() { gc = new GestionnaireChemin(); return(gc); }