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
b87ec9ce
Commit
b87ec9ce
authored
5 years ago
by
Santos Garcia Carlos
Browse files
Options
Downloads
Patches
Plain Diff
selectionpbest
parent
1ebb6d88
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
population.py
+18
-0
18 additions, 0 deletions
population.py
with
18 additions
and
0 deletions
population.py
+
18
−
0
View file @
b87ec9ce
...
...
@@ -15,6 +15,22 @@ class Population:
self
.
indiv
=
liste_individus
return
self
def
selection_p_best
(
self
,
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
)
individus_selectionnes
=
[
element
for
element
in
liste_individus
[:
p
]]
self
=
self
.
modifier_population
(
individus_selectionnes
)
def
selection_duel_pondere
(
self
,
p
=
None
):
if
p
==
None
:
p
=
(
self
.
n
)
//
2
...
...
@@ -69,6 +85,8 @@ class Population:
print
(
newself
[
i
].
score
)
self
=
self
.
modifier_population
(
newself
)
def
selection_par_rang
(
self
,
p
=
None
):
if
p
==
None
:
p
=
(
self
.
n
)
//
2
...
...
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