From 7e47e04bc26a95e9feb2a7b237d7e755df8c0cc8 Mon Sep 17 00:00:00 2001 From: Kappes Marques Rodrigo <rodrigo.kappes@student-cs.fr> Date: Tue, 28 Jan 2020 21:20:48 +0100 Subject: [PATCH] Resolved the problem of losing the best players --- __pycache__/RotTable.cpython-37.pyc | Bin 2620 -> 2571 bytes __pycache__/Traj3D.cpython-37.pyc | Bin 1958 -> 1925 bytes algogenetique.py | 2 +- population.py | 10 ++++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/__pycache__/RotTable.cpython-37.pyc b/__pycache__/RotTable.cpython-37.pyc index 0665bddc8d3fe8aeea7fabbae0d2c01f9aaae884..eda825aff2fc67047d02eda36807123f6b5899fc 100644 GIT binary patch delta 114 zcmdlZ(k;U0#LLUYz`(#TbDBY%GtWdm2}Z4n>Y5wF3Rx_EIVM}hgche36~}ld78Ilw z$GD^xXP4v`#DsY1rk2H|X6k08mR9JdmgVP^mSpDV<t1hor549*R$x8J!pJiD6{qxM SUM^)WHU<U;4n__}4kiHPb0O>i delta 169 zcmeAc*(1W|#LLUYz`($u5M>Z|n0q3h1f#)3bxpQZ=4OT{mW=_0ERJ8}85kJ!LyJ?3 ziuIE-a`IDiOLKBki}YRclS^|`^Gb^KU6b>3QWa9vGxO3@&ot&`rj{1zn=0rk1cw;u zyL#$Re#j!usK5Cq%Sjd$)?1vpi6t4OC7C(Jw^%^TB3%Xsh9V{g28JlMlEkE(RKv;l TIF)%g7#J8h7&#a@nD`O_ea<k* diff --git a/__pycache__/Traj3D.cpython-37.pyc b/__pycache__/Traj3D.cpython-37.pyc index a2a274a976ce1c2947d34c190976cd65879f2491..27f1de9630c467c4d2341a5f33c68535c5d6a139 100644 GIT binary patch delta 85 zcmZ3+-^$PD#LLUYz`($;Gt(eWmwO{$8KcE7`(&$_(Bjmh;u!D5f`ZiI7?;%I?2`O~ pm=G`B)Uue=Ox>*1(hA+wvizLVlFa<Pyu{3+)Z&=UcNtHz0sv;-9kKub delta 118 zcmZqWU&hbp#LLUYz`($udPgr#gli*T8Dr$vSOx|L{m|mnqGJ8zjGX+`+|rz!)FOSC z{N&Qy)Vz{neb?mtoK%Gr^~}8V)H98FnW?2k`lbrH3c(>p`mUb(shPT2sihUVsb%>& Wr6rm9d3lMMMXAO5oA)rDWCZ|H0Vi4j diff --git a/algogenetique.py b/algogenetique.py index 81da80b..8a1874e 100644 --- a/algogenetique.py +++ b/algogenetique.py @@ -32,7 +32,7 @@ def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"): return(best) -main(100,100,0.1,50) +main(100,100,0,50) diff --git a/population.py b/population.py index cc0e22d..828caac 100644 --- a/population.py +++ b/population.py @@ -3,6 +3,7 @@ from random import * from individu import Individu from RotTable import RotTable from croisement import croisement_un_point, croisement_deux_points +import copy class Population: def __init__(self,n): @@ -13,6 +14,9 @@ class Population: """Fonction qui renvoie une nouvelle instance de population a partir d'une liste d'individus""" self.n = len(liste_individus) self.indiv = liste_individus + for i in range(0,self.n): + self.indiv[i].evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA") + return self def selection_p_best(self,p=None): @@ -83,8 +87,6 @@ class Population: newself.append(x) else: newself.append(y) - for i in range(0, len(newself)): - print(newself[i].score) self = self.modifier_population(newself) @@ -161,8 +163,8 @@ class Population: while len(newself)<vieille_taille: m=randrange(0,self.n) t=randrange(0,self.n) - x=newself[m] - y=newself[t] + x=copy.deepcopy(newself[m]) + y=copy.deepcopy(newself[t]) couple_enfant = enfant(x,y) for child in couple_enfant : child.mutation(proba_mutation) -- GitLab