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
b16a5f59
Commit
b16a5f59
authored
5 years ago
by
Muller Sacha
Browse files
Options
Downloads
Patches
Plain Diff
Les fonctions de selections ne renvoient plus rien et modifient en place
parent
df9a5c2c
No related branches found
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
individu.py
+1
-1
1 addition, 1 deletion
individu.py
population.py
+16
-14
16 additions, 14 deletions
population.py
with
17 additions
and
15 deletions
individu.py
+
1
−
1
View file @
b16a5f59
...
...
@@ -24,7 +24,7 @@ class Individu():
first_name
=
brin
[
0
]
last_name
=
brin
[
-
1
]
rot_computed
=
self
.
table
.
R
ot_
T
able
[
last_name
+
first_name
]
rot_computed
=
self
.
table
.
r
ot_
t
able
[
last_name
+
first_name
]
rot_traj
=
first_nucleotide
-
last_nucleotide
# print(rot_traj)
# print(rot_computed)
...
...
This diff is collapsed.
Click to expand it.
population.py
+
16
−
14
View file @
b16a5f59
...
...
@@ -8,7 +8,12 @@ class Population:
def
__init__
(
self
,
n
):
self
.
indiv
=
[
Individu
(
RotTable
())
for
k
in
range
(
n
)]
self
.
n
=
n
def
modifier_population
(
self
,
liste_individus
):
"""
Fonction qui renvoie une nouvelle instance de population a partir d
'
une liste d
'
individus
"""
self
.
n
=
len
(
liste_individus
)
self
.
indiv
=
liste_individus
return
self
def
selection_duel_pondere
(
self
,
p
=
None
):
if
p
==
None
:
...
...
@@ -32,7 +37,7 @@ class Population:
else
:
newself
.
append
(
x
)
retur
n
(
newself
)
self
=
self
.
modifier_populatio
n
(
newself
)
def
selection_duel
(
self
,
p
=
None
):
if
p
==
None
:
...
...
@@ -54,7 +59,7 @@ class Population:
newself
.
append
(
x
)
else
:
newself
.
append
(
y
)
retur
n
(
newself
)
self
=
self
.
modifier_populatio
n
(
newself
)
def
selection_par_rang
(
self
,
p
=
None
):
if
p
==
None
:
...
...
@@ -97,13 +102,8 @@ class Population:
#on doit prendre l'individu avec le jème score
# print("individus selectionés", individus_selectionnes)
individus_selectionnes
.
append
(
liste_individus
[
j
-
1
])
def
modifier_population
(
self
,
liste_individus
):
self
.
n
=
len
(
liste_individus
)
self
.
indiv
=
liste_individus
return
self
self
=
modifier_population
(
self
,
individus_selectionnes
)
self
=
self
.
modifier_population
(
individus_selectionnes
)
def
selection_proportionelle
(
self
,
p
=
None
):
if
p
==
None
:
...
...
@@ -118,7 +118,7 @@ class Population:
p
=
random
(
0
,
1
)
if
p
<=
x
.
score
/
somme
:
newself
.
append
(
x
)
retur
n
(
newself
)
self
=
self
.
modifier_populatio
n
(
newself
)
def
reproduction
(
self
,
selection
=
selection_duel
,
enfant
=
croisement_un_point
,
p
=
None
):
if
p
==
None
:
...
...
@@ -130,7 +130,7 @@ class Population:
x
=
newself
[
m
]
y
=
newself
[
t
]
newself
.
append
(
enfant
(
x
,
y
))
retur
n
(
newself
)
self
=
self
.
modifier_populatio
n
(
newself
)
# def afficher(popu):
# for individu in popu.indiv :
...
...
@@ -140,11 +140,13 @@ class Population:
# def test():
# popu = Population(4)
# print("\n POPULATION INITIALE \n")
# for individu in popu.indiv :
# individu.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
# afficher(popu)
# popu.selection_
duel
()
# print("\n SELECTION
DUEL
\n")
# popu.selection_
par_rang
()
# print("\n SELECTION
PAR RANG
\n")
# afficher(popu)
# popu.reproduction
#
popu.indiv =
popu.reproduction
()
# print("\n REPRODUCTION \n")
# afficher(popu)
...
...
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