Skip to content
Snippets Groups Projects
Commit 3b29da84 authored by Kappes Marques Rodrigo's avatar Kappes Marques Rodrigo
Browse files

optimized the program(/2 the time)

parent 54270a9c
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -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")
......
first_plot.png

2.35 KiB | W: | H:

first_plot.png

2.35 KiB | W: | H:

first_plot.png
first_plot.png
first_plot.png
first_plot.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -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())
......
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():
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment