From 2daf29c6d046e65fcf9bf340c66787fa62306545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Muller?= <chloe.muller@student-cs.fr> Date: Tue, 28 Jan 2020 11:12:17 +0100 Subject: [PATCH] A vu d'oeil toutes les fonctions de selection ne produisent plus d'erreur --- population.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/population.py b/population.py index b224e3c..5fe490a 100644 --- a/population.py +++ b/population.py @@ -31,7 +31,7 @@ class Population: y=self.indiv[t] vu.add(t) vu.add(m) - p=random(0,1) + p=random() if p>x.score/(x.score+y.score): newself.append(y) else: @@ -115,7 +115,7 @@ class Population: while len(newself)<p: m=m=randrange(0, self.n) x=self.indiv[m] - p=random(0,1) + p=random() if p<=x.score/somme: newself.append(x) self = self.modifier_population(newself) @@ -152,11 +152,11 @@ def test(): # popu.selection_par_rang() # print("\n SELECTION PAR RANG \n") # afficher(popu) - popu.reproduction() + popu.reproduction(selection = popu.selection_proportionelle) print("\n REPRODUCTION \n") afficher(popu) -# test() +test() -- GitLab