Skip to content
Snippets Groups Projects
Commit e1db4fa5 authored by Santos Garcia Carlos's avatar Santos Garcia Carlos
Browse files

oui

parent 3ff492be
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
File added
File added
import mathutils
import math
import numpy
import RotTable
import individu
import population
import croisement
from Traj3D import *
from random import random
import matplotlib.pyplot as plt
def main(N,tmax,pmutation, proportion, selection="selection_duel", croisement="croisement_un_point",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):
max=0
best=None
for individu in People.indiv:
individu.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
People.reproduction(selection,p = proportion,enfant=croisement)
for individu in People.indiv:
individu.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)
plt.show()
return(individu)
main(4,10,0.015,2)
...@@ -58,7 +58,7 @@ class Population: ...@@ -58,7 +58,7 @@ class Population:
echanger(tableau,debut,randint(debut,fin-1)) echanger(tableau,debut,randint(debut,fin-1))
partition=debut partition=debut
for i in range(debut+1,fin): for i in range(debut+1,fin):
if tableau[i] < tableau[debut]: #if tableau[i] < tableau[debut]:
if tableau[i].score<tableau[debut].score: if tableau[i].score<tableau[debut].score:
partition+=1 partition+=1
echanger(tableau,i,partition) echanger(tableau,i,partition)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment