From 5241d085b2ac1f77057a25a20a3efdbd913e56ac Mon Sep 17 00:00:00 2001
From: Gauthier Roy <gauthierroy83@gmail.com>
Date: Thu, 30 Jan 2020 11:09:23 +0100
Subject: [PATCH] more dynamique version of putting the ribbon

---
 __pycache__/RotTable.cpython-36.pyc | Bin 2593 -> 2593 bytes
 algogenetique.py                    |   6 +++---
 croisement.py                       |  12 ++++++------
 first_plot.png                      | Bin 2411 -> 2412 bytes
 individu.py                         |   6 ++----
 population.py                       |   9 +++++----
 6 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/__pycache__/RotTable.cpython-36.pyc b/__pycache__/RotTable.cpython-36.pyc
index 459e4374c306aebaf525b830c17f00a8820843ca..1f5e29dc3b0df2b0334882e4c8d69ed8515fe145 100644
GIT binary patch
delta 207
zcmZ1|vQUJ}n3tC;WT{bHJkLh1KP-$+o7q`y7`1M(rljVSBo?VMFfc#}H4saQfq}t`
zfq|izi-CcGfsu!ik7;r)TO?!f<l}6mjA4^)*-IG{ChKxYOg_z?$e27?m!p<3ZSrc4
zQbwc6ik!lth9E<XL4*m2Far_hlRt8bPfp+zRAk{}#0N!KCr{!u7UkgJ;Naw7=HTLB
T=3p*jVqjp<WVto@7N<J^Xb2_9

delta 210
zcmZ1|vQUJ}n3tDJ#@;aQ7WYQ3KP-&ao7q`y7`38UQ&MwE5{pzB7#JXg8i=LDz`)?l
zz`#(<#lXP8z{tbM$2d8cEt1iD@^Q9OM!(6n?4^v+lXW>HCZA?cWQ?1v%TddiIC(Wk
zDWl<JMNVN+1CSv`Ai@|#n1Tqi$sakzCns<UDlqdg;)5cSH*yM3Uc#v;%FF=*%pANN
U%pA-`ObiSRnk-S1Z*jT<0AA)L#Q*>R

diff --git a/algogenetique.py b/algogenetique.py
index 9db84ff..8fe1a62 100644
--- a/algogenetique.py
+++ b/algogenetique.py
@@ -14,10 +14,10 @@ import time
 start_time = time.time()
 
 
-def main(N,tmax,pmutation, proportion):
+def main(N,tmax,pmutation, proportion, filename):
     
     #Creation of the initial population
-    People=Population(N)
+    People=Population(N, filename)
     L=[]
 
     #Evaluating the initial population for the histogram
@@ -72,7 +72,7 @@ def main(N,tmax,pmutation, proportion):
 #Testing our solution and printing the result in 3D
 lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
 brin = ''.join(lineList[1:])
-best,People = main(10,1000,0.05,5)
+best,People = main(100,10,0.1,5, "plasmid_8k.fasta")
 test = Traj3D()
 test.compute(brin, best.table)
 test.draw("first_plot")
diff --git a/croisement.py b/croisement.py
index e9942ef..8e160e4 100644
--- a/croisement.py
+++ b/croisement.py
@@ -2,12 +2,12 @@ import numpy
 from RotTable import RotTable
 from individu import Individu
 
-def croisement_un_point(parent1, parent2):
+def croisement_un_point(parent1, parent2, filename):
     '''Croise les tables de rotation des parents pour former deux enfants en respectant les symétries du problème'''
     ''' Retourne deux enfants'''
 
-    enfant1 = Individu(RotTable())
-    enfant2 = Individu(RotTable())
+    enfant1 = Individu(RotTable(), filename)
+    enfant2 = Individu(RotTable(), filename)
     comp = 0
     point_crois= numpy.random.random_integers(0,8)
     list_dinucleotides = sorted(RotTable().orta())
@@ -45,12 +45,12 @@ def croisement_un_point(parent1, parent2):
     return enfant1, enfant2
 
 
-def croisement_deux_points(parent1, parent2):
+def croisement_deux_points(parent1, parent2, filename):
     ''' Croise les tables de rotationd des deux parents en croisant à deux points et respectant les symétries du problème'''
     ''' Retourne deux enfants'''
 
-    enfant1 = Individu(RotTable())
-    enfant2 = Individu(RotTable())
+    enfant1 = Individu(RotTable(), filename)
+    enfant2 = Individu(RotTable(), filename)
     comp = 0
     point_crois1= numpy.random.random_integers(0,8)
     point_crois2= numpy.random.random_integers(0,8)
diff --git a/first_plot.png b/first_plot.png
index f9294f16e9e6dc29674f763436bc6927a5b6bbb7..0e536fb530ea40bc82a9395940755ad27a030609 100644
GIT binary patch
delta 30
mcmaDY^hRicC!^&=FL^cvBRxYsqltMEET-H)Pi*XZ$N>PDo(f<9

delta 29
lcmaDO^jc_wC!@tgFL_pDJwrW%iTM&NTi>>eZ|r`^0RWae3Vr|p

diff --git a/individu.py b/individu.py
index c75d145..6e06018 100644
--- a/individu.py
+++ b/individu.py
@@ -9,12 +9,10 @@ P1 = 0.015
 class Individu():
     ''' Un individu est caractérisé par sa table de rotations (individu.table)'''
     
-    def __init__(self, table):
+    def __init__(self, table, filename):
         self.table = table
-        lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+        lineList = [line.rstrip('\n') for line in open(filename)]
         self.brin = ''.join(lineList[1:])
-        #self.brin = "AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA"
-        # (sequence used for test)
         self.score = None
         self.distance = None
 
diff --git a/population.py b/population.py
index 2c89349..036717f 100644
--- a/population.py
+++ b/population.py
@@ -10,8 +10,9 @@ class Population:
 
 
     #Class initialization
-    def __init__(self,n):
-        self.indiv=[Individu(RotTable()) for k in range (n)]
+    def __init__(self,n,filename):
+        self.filename = filename
+        self.indiv=[Individu(RotTable(), self.filename) for k in range (n)]
         self.n = n
     
     #Updates the current individuals in the population  
@@ -132,7 +133,7 @@ class Population:
         if proba_mutation == None :
             proba_mutation = 0.001
         if selection == None :
-            selection = self.selection_duel
+            selection = self.selection_par_rang
         else :
             selection = liste_selections[selection]
         if p == None :
@@ -150,7 +151,7 @@ class Population:
             y=copy.deepcopy(newself[t])
 
             #Creation of the childs
-            couple_enfant = enfant(x,y)
+            couple_enfant = enfant(x,y, self.filename)
             for child in couple_enfant :
                 child.mutation_close_values(proba_mutation, number_of_mutations = 2)
                 child.evaluate()
-- 
GitLab