diff --git a/__pycache__/individu.cpython-37.pyc b/__pycache__/individu.cpython-37.pyc index 83b7aac12df9ffd210cc807f63745df4b2a39629..7e34f928d73822a2cbbf180fb54339b48b5e04c4 100644 Binary files a/__pycache__/individu.cpython-37.pyc and b/__pycache__/individu.cpython-37.pyc differ diff --git a/algogenetique.py b/algogenetique.py index e89effd2d09d553c9119e5b174ef0be757755c8e..3c025857a6bdaad65acc70446290e33480716928 100644 --- a/algogenetique.py +++ b/algogenetique.py @@ -26,7 +26,6 @@ def main(N,tmax,pmutation, proportion): S1.append(int(individu.score)) maximum=int(max(S1)) for i in range(tmax): - #print(i) mini=People.indiv[0].score best=People.indiv[0] People.reproduction(p = proportion, proba_mutation= pmutation) @@ -35,6 +34,8 @@ def main(N,tmax,pmutation, proportion): best=individu mini=individu.score L.append(mini) + print(i,":",mini) + plt.subplot(221) plt.plot([i for i in range(tmax)], L) @@ -55,7 +56,7 @@ def main(N,tmax,pmutation, proportion): lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")] brin = ''.join(lineList[1:]) -best,People = main(10,10,0.01,5) +best,People = main(200,10,0.01,100) test = Traj3D() test.compute(brin, best.table) test.draw("first_plot") diff --git a/first_plot.png b/first_plot.png index e091d954c547a80658df7854ba7835a2e39f1b11..f9294f16e9e6dc29674f763436bc6927a5b6bbb7 100644 Binary files a/first_plot.png and b/first_plot.png differ diff --git a/individu.py b/individu.py index 08744e8f0dc9a3ca276c4ff3b75c3ab6dd5cb4be..4aa5495124d36d8e413a50a06543101a30e1585c 100644 --- a/individu.py +++ b/individu.py @@ -84,10 +84,10 @@ class Individu(): # print(individu1.table.rot_table) # individu1.mutation() -table = RotTable() -test = Individu(table) -test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA") -print(test.score) +#table = RotTable() +#test = Individu(table) +#test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA") +#print(test.score) # qqun=Individu(RotTable()) diff --git a/population.py b/population.py index 7d2507349ff1cdf2d946cdb03a6cdf7eca96da7a..28a8700140b4f50e4fbad62f36110da084087edd 100644 --- a/population.py +++ b/population.py @@ -1,4 +1,3 @@ - from random import * from individu import Individu from RotTable import RotTable @@ -14,9 +13,6 @@ 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() - return self def selection_p_best(self,p=None): @@ -83,7 +79,7 @@ class Population: x=self.indiv[m] y=self.indiv[t] - if x.score<=y.score: + if x.score<y.score: newself.append(x) else: newself.append(y) @@ -207,5 +203,6 @@ def test(): +