From c1b3f780eba811d5b372627a357a8bf2f01e3af1 Mon Sep 17 00:00:00 2001
From: Gauthier Roy <gauthierroy83@gmail.com>
Date: Wed, 29 Jan 2020 15:37:34 +0100
Subject: [PATCH] add of the distance

---
 algogenetique.py |   3 ++-
 first_plot.png   | Bin 2411 -> 2412 bytes
 individu.py      |  15 ++++++++-------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/algogenetique.py b/algogenetique.py
index c445a68..7b70caf 100644
--- a/algogenetique.py
+++ b/algogenetique.py
@@ -49,6 +49,7 @@ def main(N,tmax,pmutation, proportion):
     S2=[individu.score for individu in People.indiv]
     print("Score final: ",best.score)
     print("Avg:", sum(S2)/len(S2))
+    print("Distance final: ",best.distance)
 
     plt.subplot(224)
     plt.hist(S2, range = (0,maximum+10), bins = 20, color = 'blue')
@@ -59,7 +60,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(50,20,0.05,25)
+best,People = main(100,10,0.05,10)
 test = Traj3D()
 test.compute(brin, best.table)
 test.draw("first_plot")
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 b7e0cba..1b49d07 100644
--- a/individu.py
+++ b/individu.py
@@ -16,6 +16,7 @@ class Individu():
         self.brin = ''.join(lineList[1:])
         #self.brin = "AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA"
         self.score = None
+        self.distance = None
 
     def evaluate(self):
         ''' Evalue le score d'un individu sur un nombre numb_ajout de points'''
@@ -23,7 +24,7 @@ class Individu():
         
         traj = Traj3D()
 
-        numb_ajout = 6
+        numb_ajout = 100
 
         fisrt_seq = self.brin[0:numb_ajout]
         last_seq = self.brin[-numb_ajout:]
@@ -42,10 +43,10 @@ class Individu():
                 nuc_coordonate_end = end[i]
                 distance_nuc = np.linalg.norm(nuc_coordonate_beg - nuc_coordonate_end, ord=2)
                 list_distance += [distance_nuc]
-
+        
 
         self.score = max(list_distance)
-
+        self.distance = np.linalg.norm(traj_array[numb_ajout] - traj_array[-(numb_ajout+1)], ord=2)
         #return max(list_distance)
 
 
@@ -116,10 +117,10 @@ class Individu():
 # print(individu1.table.rot_table)
 # individu1.mutation()
 
-table = RotTable()
-test = Individu(table)
-test.evaluate()
-print(test.score)
+#table = RotTable()
+#test = Individu(table)
+#test.evaluate()
+#print(test.score)
 
 
 # qqun=Individu(RotTable())
-- 
GitLab