From 0cbbb09bb336c5ec8e16ab3e0be624492e525c81 Mon Sep 17 00:00:00 2001
From: Gauthier Roy <gauthierroy83@gmail.com>
Date: Tue, 28 Jan 2020 15:35:21 +0100
Subject: [PATCH] work on fitness

---
 .vscode/settings.json               |   2 +-
 __pycache__/RotTable.cpython-36.pyc | Bin 2085 -> 2085 bytes
 __pycache__/Traj3D.cpython-36.pyc   | Bin 1976 -> 1976 bytes
 individu.py                         |  25 ++++++++++++-------------
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 395ba2d..31e7ddf 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,3 @@
 {
-    "python.pythonPath": "D:\\Programmes\\Anaconda3\\python.exe"
+    "python.pythonPath": "/Users/gauthierroy/anaconda3/bin/python"
 }
\ No newline at end of file
diff --git a/__pycache__/RotTable.cpython-36.pyc b/__pycache__/RotTable.cpython-36.pyc
index dbb2e4134f6503a6df95598a7c5505e659fc5c85..7a6158dd6374a43aa0874b27bdbf65bcfb4208a1 100644
GIT binary patch
delta 16
XcmZ1~uvCEEn3tC;$jM+MyBr4qAjt!3

delta 16
XcmZ1~uvCEEn3tD}`IY`gb~z3JB8vmV

diff --git a/__pycache__/Traj3D.cpython-36.pyc b/__pycache__/Traj3D.cpython-36.pyc
index ecd80201694553fe02c71577fca8c84a37602d91..31651032f232ae34320d1f923ad5b5548331aa50 100644
GIT binary patch
delta 52
zcmdnNzk{FMn3tC;$jM+Mdkza@)aDWvP9{df$#raTY$^;43`GW$AF+8cs!i5qmuJ+N
I?8}}F07fGWDgXcg

delta 52
zcmdnNzk{FMn3tC;;lAER_8b<*TboN*IGGrYCfBjWv8ggJFccY1e#GX*s6JVjU7k^M
IvM+l!0CT_%SO5S3

diff --git a/individu.py b/individu.py
index d01e39b..0b14b4c 100644
--- a/individu.py
+++ b/individu.py
@@ -11,23 +11,21 @@ class Individu():
     
     def evaluate(self, brin):
         traj = Traj3D()
-        traj.compute(brin, self.table)
-        traj_array = np.array(traj.getTraj())
 
-        first_nucleotide = traj_array[0, 0:3]
-        last_nucleotide = traj_array[-1, 0:3]
-        distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2))
+        fisrt_nuc = brin[0]
+        last_nu = brin[-1]
 
-        first_name = brin[0]
-        last_name = brin[-1]
+        traj.compute(brin + fisrt_nuc, self.table)
+        traj_array = np.array(traj.getTraj())
 
-        rot_computed = self.table.Rot_Table[last_name+first_name]
-        rot_traj = first_nucleotide - last_nucleotide
-        print(rot_traj)
-        print(rot_computed)
-        diff_angle = sum(abs(rot_computed - rot_traj))
+        first_nuc_coordonate = traj_array[0, 0:3]
+        last_nuc_coordonate = traj_array[-2, 0:3]
 
-        self.score = 1/(distance + diff_angle)
+        test = np.linalg.norm(first_nuc_coordonate - last_nuc_coordonate, ord=2)
+        distance = sqrt(sum((first_nuc_coordonate - last_nuc_coordonate) ** 2))
+        diff_ideal_distance = abs(3.38 - distance)
+        diff_ideal_distance_2 = abs(3.38 - test)
+        self.score = (1/(diff_ideal_distance ), 1/diff_ideal_distance_2)
         
     
     def mutation(self):
@@ -37,4 +35,5 @@ class Individu():
 table = RotTable()
 test = Individu(table)
 test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
+print(table.rot_table)
 print(test.score)
-- 
GitLab