diff --git a/.DS_Store b/.DS_Store
index ce584036d310ff852c50dff6063d64ba8881c0a3..c6bf50dfd786e007f7389525a204a30892ff7c32 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/README.md b/README.md
index f18054be9d47027bfb4d1f5c892c9d55bce0aad4..5e3ad594798d420817138bfe47201f841ad8c1d3 100644
--- a/README.md
+++ b/README.md
@@ -36,3 +36,13 @@ Sont fournis :
 - le fichier <tt>Main.py</tt> illustrant un exemple d'utilisation de la classe Traj3D,
 - deux fichiers <tt>.fasta</tt> contenant les séquences de deux plasmides de longueur différente (8 000 dans un cas et 180 000 dans l'autre).
 
+
+## Instructions
+
+Le groupe est composé de Loïc Busson, Claire Zhao, Sandra Ayumi, Rodrigo Kappes, Solal O'Sullivan, Chloé Muller, Gauthier Roy et Carlos Santos Garcia.
+Pour utiliser notre algorithme génétique, appeler la fonction main() du fichier algogenetique.py en introduisant le nombre d'individus par générations, le nombre de générations, la probabilité de mutation et le nombre d'individus séléctionnés à chaque itération. L'algorithme évalue les individus sur la séquence de nucléotides choisie. Il affiche aussi la trajectoire de la séquence voulue avec la meilleure table de rotations générée par l'algorithme à la dernière étape.
+Les fichiers introduits par nous sont:
+- individu.py: Création de la classe Individu (attributs et méthodes) qui permettent de donner un score à chaque table de rotations et l'apparition de mutations.
+- population.py: Création de la classe Population. Une population à un attribut "indiv" qui est une liste d'individus, chacun caractérisé par sa table de rotations. Cette classe permet de faire la séléction des individus à garder à chaque itération par de différentes méthodes et d'actualiser la population.
+- algogenetique.py : Rassemble les fonctionnalités des autres algorithmes pour faire tourner l'algorithme génétique et afficher la trajectoire après l'algorithme génétique.
+- croisement.py : Fonctions de croisement utilisées pour la génération des enfants au moment de la 
diff --git a/__pycache__/RotTable.cpython-36.pyc b/__pycache__/RotTable.cpython-36.pyc
index a8064bb45dbaad46db289f9e730b7dd816423ae4..459e4374c306aebaf525b830c17f00a8820843ca 100644
Binary files a/__pycache__/RotTable.cpython-36.pyc and b/__pycache__/RotTable.cpython-36.pyc differ
diff --git a/__pycache__/croisement.cpython-37.pyc b/__pycache__/croisement.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..32aa8054c9bf4394aa2cc4dd70c8392a65cdfb6c
Binary files /dev/null and b/__pycache__/croisement.cpython-37.pyc differ
diff --git a/__pycache__/individu.cpython-37.pyc b/__pycache__/individu.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..511c39dc9171fe22debb9b7099e4280bc25823aa
Binary files /dev/null and b/__pycache__/individu.cpython-37.pyc differ
diff --git a/__pycache__/population.cpython-37.pyc b/__pycache__/population.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..037163fdebd2a013e0b24fa10c0ea6f91cff2c10
Binary files /dev/null and b/__pycache__/population.cpython-37.pyc differ
diff --git a/algogenetique.py b/algogenetique.py
index 8a1874e03d214a4c3f2f9804b275af26d35d8f5e..f4f6843131073fee0075dc060c685983afa70caa 100644
--- a/algogenetique.py
+++ b/algogenetique.py
@@ -4,35 +4,146 @@ import numpy
 import RotTable
 from individu import Individu
 from population import Population, afficher
-import croisement
+from croisement import * 
 from Traj3D import *
 from random import random
 import matplotlib.pyplot as plt
+import time
+from copy import deepcopy
 
+# def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"):
+#     '''lineList = [line.rstrip('\n') for line in open(brin)]
+# 	brin = ''.join(lineList[1:])'''
+#     L=[]
+#     People=Population(N)
+#     for i in range(tmax):
+#         print(i)
+#         max=0
+#         best=None
+#         People.reproduction(p = proportion, proba_mutation= pmutation)
+#         for individu in People.indiv:
+#             if individu.score>max:
+#                 best=individu
+#                 max=individu.score
+#         L.append(max)
 
+#     plt.plot([i for i in range(tmax)], L, label = str(pmutation))
+#     return(best)
 
-def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"):
-    '''lineList = [line.rstrip('\n') for line in open(brin)]
-	brin = ''.join(lineList[1:])'''
-    L=[]
-    People=Population(N)
+def main(N,tmax,pmutation, proportion, indice_selection, population_initiale, enfant = croisement_un_point):
+
+    
+    lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+    brin = ''.join(lineList[1:])
+    People=deepcopy(population_initiale)
+    # S1=[]
+    for individu in People.indiv:
+        individu.evaluate()
+        # S1.append(int(individu.score))
+    # maximum=int(max(S1))
+    mini=People.indiv[0].score
+    for individu in People.indiv:
+            if individu.score<mini:
+                mini=individu.score
+    # L=[mini]
     for i in range(tmax):
         print(i)
-        max=0
-        best=None
-        People.reproduction(p = proportion, proba_mutation= pmutation)
+        People.reproduction(p = proportion, proba_mutation= pmutation, selection = indice_selection, enfant = enfant)
+        mini=People.indiv[0].score
+        best=People.indiv[0]
         for individu in People.indiv:
-            if individu.score>max:
+            if individu.score<mini:
                 best=individu
-                max=individu.score
-        L.append(max)
+                mini=individu.score
+        
+        # S2=[individu.score for individu in People.indiv]
+        # avg = sum(S2)/len(S2)
+        # L.append(mini)
+
+    # plt.subplot(221)
+    # liste_selections = ["selection_p_best", "selection_duel_pondere", "selection_duel", "selection_par_rang", "selection_proportionnelle"]
+    # plt.plot([j for j in range(len(L))], L, label = liste_selections[indice_selection])
+    
+
+    # plt.subplot(223)
+    # plt.hist(S1, range = (0, maximum+10), bins = 20, color = 'red')
+
+    # S2=[individu.score for individu in People.indiv]
+    # print("Score final: ",best.score)
+
+
+    # plt.subplot(224)
+    # plt.hist(S2, range = (0,maximum+10), bins = 20, color = 'blue')
+    # plt.show()
+   
+
+    return(best,People)
+
+# lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+# brin = ''.join(lineList[1:])
+# best,People = main(10,10,0.01,5)
+# test = Traj3D()
+# test.compute(brin, best.table)
+# test.draw("first_plot")
+
+
+
+def compare_mutation():
+    start_time = time.time()
+    plt.figure()
+    for i in range(1,5):
+        print("\n \n", i)
+        main(100,40,10**(-i),50)
+    plt.legend()
+    plt.xlabel("Nombre de générations")
+    plt.ylabel("Score du meilleur individu")
+    plt.title("Comparaison en fonction du taux de mutation")
+    print("Temps d'execution : %s secondes " % (time.time() - start_time))
+    plt.show()   
+
+
+def comparaison_selections():
+    liste_selections = ["selection_p_best", "selection_duel_pondere", "selection_duel", "selection_par_rang", "selection_proportionnelle"]
+    liste_time = []
+    # plt.figure()
+    People = Population(100)
+    # S2=[individu.score for individu in People.indiv]
+    # plt.hist(S2, range = (0,int(max(S2)+10)), bins = 20, color = 'blue')
+    # plt.show()
+    # plt.figure()
+    for i in range(5):
+        print("\n", liste_selections[i], "\n")
+        start_time = time.time()
+        best = main(100, 35, 0.001, 50, i, deepcopy(People), enfant = croisement_deux_points)[0]
+        liste_time.append((liste_selections[i], time.time() - start_time, best.score))
+    # plt.legend()
+    # plt.xlabel("Nombre de générations")
+    # plt.ylabel("Score du meilleur individu")
+    # plt.title("Comparaison en fonction de la méthode de sélection")
+    return numpy.array(liste_time)
+    # plt.show()   
+
+# def comparaisons_croisements():
+#     liste_croisements = ["croisement_un_point", "croisement_deux_points"]
 
-    plt.plot([i for i in range(tmax)], L)
-    plt.show()
-    return(best)
 
 
-main(100,100,0,50)
 
+# compare_mutation()
+liste = []
+for i in range(5):
+    liste.append(comparaison_selections())
+    print(liste)
+print(liste)
 
+# [['selection_p_best' '22.637820959091187' '116.30569654472626']
+#  ['selection_duel_pondere' '22.636890172958374' '46.6242321955727']
+#  ['selection_duel' '22.21168804168701' '234.7640748029787']
+#  ['selection_par_rang' '22.180259227752686' '190.0163752068961']
+#  ['selection_proportionnelle' '22.329176902770996' '315.7030719673908']]
 
+# [['selection_p_best' '22.775274991989136' '106.89365704155766']
+#  ['selection_duel_pondere' '22.716803073883057' '284.11538487097084']
+#  ['selection_duel' '23.19036889076233' '155.83887357033393']
+#  ['selection_par_rang' '22.752396821975708' '118.6068497149259']
+#  ['selection_proportionnelle' '22.71982979774475' '151.80114914793427']]
\ No newline at end of file
diff --git a/croisement.py b/croisement.py
index 96f85a8a89e1dcaa97cbed0f06233942ee36f211..95119ecfe8ad91ea23492e9e9eab8fb3ced18b09 100644
--- a/croisement.py
+++ b/croisement.py
@@ -23,11 +23,14 @@ ROT_TABLE = {\
 
 
 def croisement_un_point(parent1, parent2):
+    '''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())
     comp = 0
     point_crois= numpy.random.random_integers(0,8)
-    for doublet in ROT_TABLE:
+    list_dinucleotides = sorted(ROT_TABLE)
+    for doublet in list_dinucleotides:
         if doublet == "GA":
             break
         if comp < point_crois:
@@ -57,12 +60,15 @@ def croisement_un_point(parent1, parent2):
 
 
 def croisement_deux_points(parent1, parent2):
+    ''' 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())
     comp = 0
     point_crois1= numpy.random.random_integers(0,8)
     point_crois2= numpy.random.random_integers(0,8)
-    for doublet in ROT_TABLE:
+    list_dinucleotides = sorted(ROT_TABLE)
+    for doublet in list_dinucleotides:
         if comp < min(point_crois1,point_crois2) or comp > max(point_crois1,point_crois2):
             enfant1.table.rot_table[doublet] = parent1.table.rot_table[doublet]
             correspondent_doublet1 = enfant1.table.corr()[doublet]
diff --git a/individu.py b/individu.py
index 24193810b0c780eb4bc09bdd034a82094d59f376..aac0d3a86d5f801556c132dfeda1293e925526b4 100644
--- a/individu.py
+++ b/individu.py
@@ -2,49 +2,56 @@ from RotTable import RotTable
 from Traj3D import Traj3D
 import numpy as np
 from math import sqrt, inf
-from random import random
+from random import random, choice
 
 P1 = 0.015
 
 class Individu():
-
+    ''' Un individu est caractérisé par sa table de rotations (individu.table)'''
     def __init__(self, table):
+        lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+        brin = ''.join(lineList[1:])
         self.table = table
-        self.score = self.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
-    
-    def evaluate(self, brin):
+        lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+        self.brin = ''.join(lineList[1:])
+        #self.brin = "AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA"
+        self.score = None
+
+    def evaluate(self):
+        ''' Evalue le score d'un individu sur un nombre numb_ajout de points'''
+        
+        
         traj = Traj3D()
 
-        numb_ajout = 3
+        numb_ajout = 100
+
+        fisrt_seq = self.brin[0:numb_ajout]
+        last_seq = self.brin[-numb_ajout:]
 
-        fisrt_seq = brin[0:numb_ajout]
-        last_seq = brin[-numb_ajout:]
+        traj.compute(last_seq + self.brin + fisrt_seq, self.table)
+        traj_array = traj.getTraj()
 
-        traj.compute(last_seq + brin + fisrt_seq, self.table)
-        traj_array = np.array(traj.getTraj())
         list_distance = []
 
-        for i in range(numb_ajout):
-                first_nuc_coordonate = traj_array[numb_ajout+i, 0:3]
-                first_nuc_coordonate_compute = traj_array[-(numb_ajout-i), 0:3]
-                
-                last_nuc_coordonate = traj_array[-(2*numb_ajout-i), 0:3]
-                last_nuc_coordonate_compute = traj_array[i, 0:3]
+        begining = traj_array[0:2*numb_ajout]
+        end = traj_array[-2*numb_ajout:]
 
-                distance_first_nuc = np.linalg.norm(first_nuc_coordonate - first_nuc_coordonate_compute, ord=2)
-                distance_last_nuc = np.linalg.norm(last_nuc_coordonate - last_nuc_coordonate_compute, ord=2)
+        for i in range(numb_ajout):
 
-                list_distance += [distance_first_nuc, distance_last_nuc]
+                nuc_coordonate_beg = begining[i]
+                nuc_coordonate_end = end[i]
+                distance_nuc = np.linalg.norm(nuc_coordonate_beg - nuc_coordonate_end, ord=2)
+                list_distance += [distance_nuc]
 
 
-        self.score = 1/max(list_distance)
+        self.score = max(list_distance)
 
-        return 1/max(list_distance)
+        #return max(list_distance)
 
 
     def mutation(self, proba = P1):
         table_rotations = self.table.rot_table
-        for doublet in table_rotations :
+        for doublet in sorted(table_rotations.keys()) :
             for coord in range(3):
                 tir = random()
                 if tir < proba :
@@ -56,6 +63,54 @@ class Individu():
                         #sur l'axe z il y a un moins
                         table_rotations[doublet2][coord] = - table_rotations[doublet][coord]
 
+    def mutation_with_numbers(self, proba = P1, number_of_mutations = 1):
+        table_rotations = self.table.rot_table
+        table_rotation_not_seen = [i for i in sorted(table_rotations.keys())]
+        table_rotation_not_seen = table_rotation_not_seen[:8]
+
+        tir = random()
+        if tir < proba :
+            for i in range(0,number_of_mutations):
+                
+                doublet = choice(table_rotation_not_seen)
+                table_rotation_not_seen.remove(doublet)
+
+                for coord in range(3):
+                    table_rotations[doublet][coord] =np.random.uniform(low = self.table.orta()[doublet][coord] - self.table.orta()[doublet][coord + 3], high = self.table.orta()[doublet][coord] + self.table.orta()[doublet][coord + 3])
+                    doublet2 = self.table.corr()[doublet]
+                    if coord == 0 or coord == 1 :
+                        table_rotations[doublet2][coord] = table_rotations[doublet][coord]
+                    else :
+                        #sur l'axe z il y a un moins
+                        table_rotations[doublet2][coord] = - table_rotations[doublet][coord]
+
+
+    def mutation_close_values(self, proba = P1, number_of_mutations = 1):
+        table_rotations = self.table.rot_table
+        table_rotation_not_seen = [i for i in sorted(table_rotations.keys())]
+        table_rotation_not_seen = table_rotation_not_seen[:8]
+
+        tir = random()
+        if tir < proba :
+            for i in range(0,number_of_mutations):
+
+                doublet = choice(table_rotation_not_seen)
+                table_rotation_not_seen.remove(doublet)
+
+                for coord in range(3):
+                    value = table_rotations[doublet][coord] + np.random.normal(0, self.table.orta()[doublet][coord + 3]/15)
+                    if value > self.table.orta()[doublet][coord] + self.table.orta()[doublet][coord + 3]:
+                        value = self.table.orta()[doublet][coord] + self.table.orta()[doublet][coord + 3]
+                    elif value < self.table.orta()[doublet][coord] - self.table.orta()[doublet][coord + 3]:
+                        value = self.table.orta()[doublet][coord] - self.table.orta()[doublet][coord + 3]
+                    table_rotations[doublet][coord] = value
+                    
+                    doublet2 = self.table.corr()[doublet]
+                    if coord == 0 or coord == 1 :
+                        table_rotations[doublet2][coord] = table_rotations[doublet][coord]
+                    else :
+                        #sur l'axe z il y a un moins
+                        table_rotations[doublet2][coord] = - table_rotations[doublet][coord]
 
 # individu1 = Individu(RotTable())
 # print(individu1.table.rot_table)
diff --git a/inutile.py b/inutile.py
deleted file mode 100644
index 420a646fc6e25c17b5aec102de8321736ae1ebaf..0000000000000000000000000000000000000000
--- a/inutile.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import numpy
-
-ORIGINAL_ROT_TABLE = {\
-        "AA": [35.62, 7.2, -154, 0.06, 0.6, 0],\
-        "AC": [34.4, 1.1, 143, 1.3, 5, 0],\
-        "AG": [27.7, 8.4, 2, 1.5, 3, 0],\
-        "AT": [31.5, 2.6, 0, 1.1, 2, 0],\
-        "CA": [34.5, 3.5, -64, 0.9, 34, 0],\
-        "CC": [33.67, 2.1, -57, 0.07, 2.1, 0],\
-        "CG": [29.8, 6.7, 0, 1.1, 1.5, 0],\
-        "CT": [27.7, 8.4, -2, 1.5, 3, 0],\
-        "GA": [36.9, 5.3, 120, 0.9, 6, 0],\
-        "GC": [40, 5, 180, 1.2, 1.275, 0],\
-        "GG": [33.67, 2.1, 57, 0.07, 2.1, 0],\
-        "GT": [34.4, 1.1, -143, 1.3, 5, 0],\
-        "TA": [36, 0.9, 0, 1.1, 2, 0],\
-        "TC": [36.9, 5.3, -120, 0.9, 6, 0],\
-        "TG": [34.5, 3.5, 64, 0.9, 34, 0],\
-        "TT": [35.62, 7.2, -154, 0.06, 0.6, 0]\
-            }
-
-class rotation:
-    def __init__(self,doublet):
-        self.x = numpy.random.uniform(low = ORIGINAL_ROT_TABLE[doublet][0] - ORIGINAL_ROT_TABLE[doublet][3], high = ORIGINAL_ROT_TABLE[doublet][0] + ORIGINAL_ROT_TABLE[doublet][3])
-        self.y = numpy.random.uniform(low = ORIGINAL_ROT_TABLE[doublet][1] - ORIGINAL_ROT_TABLE[doublet][4], high = ORIGINAL_ROT_TABLE[doublet][1] + ORIGINAL_ROT_TABLE[doublet][4])
-        self.z = ORIGINAL_ROT_TABLE[doublet][2]
-        self.doublet = doublet
-
-class table_rotation(rotation):
-    def __init__(self):
-        self.dict = {doublet : rotation(doublet) for doublet in ORIGINAL_ROT_TABLE}
-
-table1 = table_rotation()
-# print(table1.dict["AA"].x)
-
-#table1.dict --> {'AA': <__main__.rotation object at 0x000001A722E1BAC8>, 'AC': <__main__.rotation object at 0x000001A722E1BB00>, 'AG': <__main__.rotation object at 0x000001A729A66A58>, 'AT': <__main__.rotation object at 0x000001A729A66A20>, 'CA': <__main__.rotation object at 0x000001A729A669E8>, 'CC': <__main__.rotation object at 0x000001A729A66A90>, 'CG': <__main__.rotation object at 0x000001A729A66B00>, 'CT': <__main__.rotation object at 0x000001A729A66B70>, 'GA': <__main__.rotation object at 0x000001A729B88D68>, 'GC': <__main__.rotation object at 0x000001A729B88DA0>, 'GG': <__main__.rotation object at 0x000001A729B88DD8>, 'GT': <__main__.rotation object at 0x000001A729B88E10>, 'TA': <__main__.rotation object at 0x000001A729B88E48>, 'TC': <__main__.rotation object at 0x000001A729B88E80>, 'TG': <__main__.rotation object at 0x000001A729B88EB8>, 'TT': <__main__.rotation object at 0x000001A729B88EF0>}
-#table1.dict["AA"] ---> <__main__.rotation object at 0x000001A722E1BAC8> (qui est l'object rotation)
-#table1.dict["AA"].x ---> 35.67097790545279 (rotation selon x de AA)
\ No newline at end of file
diff --git a/population.py b/population.py
index cb80409a35d2ffcd31cf83ad820f00756df77a66..618126d9c9589a39ab2ccd3748595efb0fc63e43 100644
--- a/population.py
+++ b/population.py
@@ -1,4 +1,3 @@
-
 from random import *
 from individu import Individu
 from RotTable import RotTable
@@ -14,26 +13,13 @@ 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("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
-
         return self
 
     def selection_p_best(self,p=None):
         if p==None:
             p=(self.n)//2
-            
-        def tri_rapide_aux(tableau,debut,fin):
-            if debut < fin-1:
-                positionPivot=partitionner(tableau,debut,fin)
-                tri_rapide_aux(tableau,debut,positionPivot)
-                tri_rapide_aux(tableau,positionPivot+1,fin)
-            
-        def tri_rapide(tableau):
-            tri_rapide_aux(tableau,0,len(tableau))
-        
         liste_individus=self.indiv
-        tri_rapide(liste_individus)
+        liste_individus.sort(key = lambda individu : individu.score)
         individus_selectionnes = [element for element in liste_individus[:p]]
         self = self.modifier_population(individus_selectionnes)
 
@@ -41,21 +27,23 @@ class Population:
     def selection_duel_pondere(self,p=None): 
         if p == None :
             p = (self.n)//2
-        newself=[] 
-        vu=set()
+        meilleur = self.indiv[0]
+        for individu in self.indiv :
+            if meilleur.score > individu.score:
+                meilleur = individu
+        newself=[meilleur] 
         m=randrange(0,self.n)
         t=randrange(0,self.n)                   #méthode des duels pondérée: si x=10 et y=1, y a une chance sur 11 de passer
+        non_vu = [i for i in range(0, self.n)]          
         while len(newself)<p:
-            while m in vu:
-                m=randrange(0,self.n)
-            while t in vu:
-                t=randrange(0,self.n)
+            m = choice(non_vu)
+            non_vu.remove(m)
+            t = choice(non_vu)
+            non_vu.remove(t)
             x=self.indiv[m]
             y=self.indiv[t]
-            vu.add(t)
-            vu.add(m)
             proba=random()
-            if proba>x.score/(x.score+y.score):
+            if proba<x.score/(x.score+y.score):
                 newself.append(y)
             else:
                 newself.append(x)
@@ -67,11 +55,9 @@ class Population:
             p = (self.n)//2
         meilleur = self.indiv[0]
         for individu in self.indiv :
-            if meilleur.score < individu.score:
-                print("meilleur, individu: ", meilleur.score, individu.score)
+            if meilleur.score > individu.score:
                 meilleur = individu
-        newself = [meilleur]
-        vu=set()                        
+        newself = [meilleur]                      
         t=randrange(0,self.n)
         m=randrange(0,self.n)
         non_vu = [i for i in range(0, self.n)]          
@@ -83,7 +69,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)
@@ -95,35 +81,11 @@ class Population:
         if p == None :
             p = (self.n)//2
         liste_individus = self.indiv
-        n = self.n
-        
-        def echanger(tableau, i, j):
-            tableau[i], tableau[j] = tableau[j], tableau[i]
-            
-        def partitionner(tableau,debut,fin):
-            echanger(tableau,debut,randint(debut,fin-1)) 
-            partition=debut
-            for i in range(debut+1,fin):
-                # if tableau[i] < tableau[debut]:
-                if tableau[i].score<tableau[debut].score: 
-                    partition+=1 
-                    echanger(tableau,i,partition) 
-            echanger(tableau,debut,partition) 
-            return partition
-            
-        def tri_rapide_aux(tableau,debut,fin):
-            if debut < fin-1:
-                positionPivot=partitionner(tableau,debut,fin)
-                tri_rapide_aux(tableau,debut,positionPivot)
-                tri_rapide_aux(tableau,positionPivot+1,fin)
-            
-        def tri_rapide(tableau):
-            tri_rapide_aux(tableau,0,len(tableau))
-            
-        tri_rapide(liste_individus)
-        individus_selectionnes = []
+        n = self.n        
+        liste_individus.sort(key = lambda individu : individu.score, reverse = True)
+        individus_selectionnes = [liste_individus[-1]]
     
-        for _ in range(p):
+        for _ in range(p-1):
             curseur = random()*n*(n+1)/2
             # print("curseur", curseur)
             j = 1
@@ -135,13 +97,17 @@ class Population:
         
         self = self.modifier_population(individus_selectionnes)
         
-    def selection_proportionelle(self,p= None):
+    def selection_proportionnelle(self,p= None):
         if p == None :
             p = (self.n)//2
-        newself=[]
+        meilleur = self.indiv[0]
+        for individu in self.indiv :
+            if meilleur.score > individu.score:
+                meilleur = individu
+        newself = [meilleur]      
         somme=0
         for indiv in self.indiv:
-            somme=somme+indiv.score
+            somme+=1/indiv.score
         while len(newself)<p:
             m=m=randrange(0, self.n)
             x=self.indiv[m]
@@ -151,10 +117,13 @@ class Population:
         self = self.modifier_population(newself)
 
     def reproduction(self,proba_mutation = None, selection=None,enfant=croisement_un_point, p = None):
+        liste_selections = [self.selection_p_best, self.selection_duel_pondere, self.selection_duel, self.selection_par_rang, self.selection_proportionnelle]
         if proba_mutation == None :
             proba_mutation = 0.001
         if selection == None :
             selection = self.selection_duel
+        else :
+            selection = liste_selections[selection]
         if p == None :
             p = (self.n)//2
         vieille_taille = self.n
@@ -167,8 +136,8 @@ class Population:
             y=copy.deepcopy(newself[t])
             couple_enfant = enfant(x,y)
             for child in couple_enfant :
-                child.mutation(proba_mutation)
-                child.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
+                child.mutation_close_values(proba_mutation, number_of_mutations = 2)
+                child.evaluate()
             newself.append(couple_enfant[0])
             newself.append(couple_enfant[1])
         self = self.modifier_population(newself)
@@ -177,14 +146,14 @@ class Population:
 def afficher(popu):
     for individu in popu.indiv :
         print("\n individu \n")
-        print(individu.table.rot_table)
+        # print(individu.table.rot_table)
         print ("score", individu.score)
     
 def test():
     popu = Population(4)
     print("\n POPULATION INITIALE \n")
     for individu in popu.indiv :
-        individu.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
+        individu.evaluate()
     afficher(popu)
     popu.reproduction(selection = popu.selection_duel)
     print("\n REPRODUCTION \n")
@@ -192,9 +161,21 @@ def test():
 
 #test()
 
+def test2():
+    popu = Population(10)
+    for individu in popu.indiv :
+        lineList = [line.rstrip('\n') for line in open("plasmid_8k.fasta")]
+        brin = ''.join(lineList[1:])
+        individu.evaluate()
+    print("\n \n POPULATION INITIALE \n \n")
+    afficher(popu)
+    popu.selection_proportionnelle()
+    print("\n\nAPRES SELECTION \n\n")
+    afficher(popu)
     
 
 
+# test2()