Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EI Jeux Evolutionnaires
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Santos Garcia Carlos
EI Jeux Evolutionnaires
Commits
246bb57c
Commit
246bb57c
authored
5 years ago
by
Muller Sacha
Browse files
Options
Downloads
Patches
Plain Diff
mutations seulement sur les enfants
parent
42387077
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
algogenetique.py
+6
-5
6 additions, 5 deletions
algogenetique.py
population.py
+11
-2
11 additions, 2 deletions
population.py
with
17 additions
and
7 deletions
algogenetique.py
+
6
−
5
View file @
246bb57c
...
...
@@ -16,21 +16,22 @@ def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"):
brin =
''
.join(lineList[1:])
'''
L
=
[]
People
=
Population
(
N
)
afficher
(
People
)
#
afficher(People)
for
i
in
range
(
tmax
):
print
(
"
\n
\n
NOUVELLE GENERATION
\n
\n
"
)
max
=
0
best
=
None
for
individu
in
People
.
indiv
:
individu
.
evaluate
(
"
AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA
"
)
People
.
reproduction
(
p
=
proportion
)
for
individu
in
People
.
indiv
:
individu
.
mutation
(
pmutation
)
People
.
reproduction
(
p
=
proportion
,
proba_mutation
=
pmutation
)
#
for individu in People.indiv:
#
individu.mutation(pmutation)
for
individu
in
People
.
indiv
:
individu
.
evaluate
(
"
AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA
"
)
if
individu
.
score
>
max
:
best
=
individu
max
=
individu
.
score
afficher
(
People
)
L
.
append
(
max
)
#print(L)
plt
.
plot
([
i
for
i
in
range
(
tmax
)],
L
)
...
...
@@ -38,7 +39,7 @@ def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"):
return
(
best
)
main
(
10
0
,
50
,
0
.015
,
5
0
)
main
(
10
,
50
,
0
,
5
)
This diff is collapsed.
Click to expand it.
population.py
+
11
−
2
View file @
246bb57c
...
...
@@ -42,7 +42,12 @@ class Population:
def
selection_duel
(
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
]
print
(
"
\n
\n
\n
meilleur
"
,
meilleur
.
table
.
rot_table
,
"
\n
\n
score
"
,
meilleur
.
score
)
vu
=
set
()
t
=
randrange
(
0
,
self
.
n
)
m
=
randrange
(
0
,
self
.
n
)
...
...
@@ -120,7 +125,9 @@ class Population:
newself
.
append
(
x
)
self
=
self
.
modifier_population
(
newself
)
def
reproduction
(
self
,
selection
=
None
,
enfant
=
croisement_un_point
,
p
=
None
):
def
reproduction
(
self
,
proba_mutation
=
None
,
selection
=
None
,
enfant
=
croisement_un_point
,
p
=
None
):
if
proba_mutation
==
None
:
proba_mutation
=
0.001
if
selection
==
None
:
selection
=
self
.
selection_duel
if
p
==
None
:
...
...
@@ -134,6 +141,8 @@ class Population:
x
=
newself
[
m
]
y
=
newself
[
t
]
couple_enfant
=
enfant
(
x
,
y
)
for
child
in
couple_enfant
:
child
.
mutation
(
proba_mutation
)
newself
.
append
(
couple_enfant
[
0
])
newself
.
append
(
couple_enfant
[
1
])
self
=
self
.
modifier_population
(
newself
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment