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
6b0a5e4b
Commit
6b0a5e4b
authored
5 years ago
by
Muller Sacha
Browse files
Options
Downloads
Patches
Plain Diff
Plus d'erreur pour le test (mais ca marche pas tres bien quand meme)
parent
9b0ee3ab
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
croisement.py
+7
-6
7 additions, 6 deletions
croisement.py
population.py
+7
-7
7 additions, 7 deletions
population.py
with
14 additions
and
13 deletions
croisement.py
+
7
−
6
View file @
6b0a5e4b
import
numpy
import
numpy
from
RotTable
import
RotTable
from
RotTable
import
RotTable
from
individu
import
Individu
ROT_TABLE
=
{
\
ROT_TABLE
=
{
\
"
AA
"
:
[
35.62
,
7.2
,
-
154
,
0.06
,
0.6
,
0
],
\
"
AA
"
:
[
35.62
,
7.2
,
-
154
,
0.06
,
0.6
,
0
],
\
...
@@ -22,17 +23,17 @@ ROT_TABLE = {\
...
@@ -22,17 +23,17 @@ ROT_TABLE = {\
def
croisement_un_point
(
parent1
,
parent2
):
def
croisement_un_point
(
parent1
,
parent2
):
enfant1
=
RotTable
()
enfant1
=
Individu
(
RotTable
()
)
enfant2
=
RotTable
()
enfant2
=
Individu
(
RotTable
()
)
comp
=
0
comp
=
0
point_crois
=
numpy
.
random
.
random_integers
(
0
,
16
)
point_crois
=
numpy
.
random
.
random_integers
(
0
,
16
)
for
doublet
in
ROT_TABLE
:
for
doublet
in
ROT_TABLE
:
if
comp
<
point_crois
:
if
comp
<
point_crois
:
enfant1
.
rot_table
[
doublet
]
=
parent1
.
rot_table
[
doublet
]
enfant1
.
table
.
rot_table
[
doublet
]
=
parent1
.
table
.
rot_table
[
doublet
]
enfant2
.
rot_table
[
doublet
]
=
parent2
.
rot_table
[
doublet
]
enfant2
.
table
.
rot_table
[
doublet
]
=
parent2
.
table
.
rot_table
[
doublet
]
else
:
else
:
enfant1
.
rot_table
[
doublet
]
=
parent2
.
rot_table
[
doublet
]
enfant1
.
table
.
rot_table
[
doublet
]
=
parent2
.
table
.
rot_table
[
doublet
]
enfant2
.
rot_table
[
doublet
]
=
parent1
.
rot_table
[
doublet
]
enfant2
.
table
.
rot_table
[
doublet
]
=
parent1
.
table
.
rot_table
[
doublet
]
comp
+=
1
comp
+=
1
return
enfant1
,
enfant2
return
enfant1
,
enfant2
...
...
This diff is collapsed.
Click to expand it.
population.py
+
7
−
7
View file @
6b0a5e4b
...
@@ -20,8 +20,8 @@ class Population:
...
@@ -20,8 +20,8 @@ class Population:
p
=
(
self
.
n
)
//
2
p
=
(
self
.
n
)
//
2
newself
=
[]
newself
=
[]
vu
=
set
()
vu
=
set
()
m
=
None
m
=
randrange
(
0
,
self
.
n
)
t
=
None
#méthode des duels pondérée: si x=10 et y=1, y a une chance sur 11 de passer
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
while
len
(
newself
)
<
p
:
while
len
(
newself
)
<
p
:
while
m
in
vu
:
while
m
in
vu
:
m
=
randrange
(
0
,
self
.
n
)
m
=
randrange
(
0
,
self
.
n
)
...
@@ -44,14 +44,12 @@ class Population:
...
@@ -44,14 +44,12 @@ class Population:
p
=
(
self
.
n
)
//
2
p
=
(
self
.
n
)
//
2
newself
=
[]
newself
=
[]
vu
=
set
()
vu
=
set
()
t
=
None
t
=
randrange
(
0
,
self
.
n
)
m
=
None
m
=
randrange
(
0
,
self
.
n
)
while
len
(
newself
)
<
p
:
while
len
(
newself
)
<
p
:
while
m
in
vu
:
while
m
in
vu
:
print
(
"
self.n
"
,
self
.
n
)
m
=
randrange
(
0
,
self
.
n
)
m
=
randrange
(
0
,
self
.
n
)
while
t
in
vu
:
while
t
in
vu
:
print
(
"
self.n
"
,
self
.
n
)
t
=
randrange
(
0
,
self
.
n
)
t
=
randrange
(
0
,
self
.
n
)
x
=
self
.
indiv
[
m
]
x
=
self
.
indiv
[
m
]
y
=
self
.
indiv
[
t
]
y
=
self
.
indiv
[
t
]
...
@@ -135,7 +133,9 @@ class Population:
...
@@ -135,7 +133,9 @@ class Population:
t
=
randrange
(
0
,
self
.
n
)
t
=
randrange
(
0
,
self
.
n
)
x
=
newself
[
m
]
x
=
newself
[
m
]
y
=
newself
[
t
]
y
=
newself
[
t
]
newself
.
append
(
enfant
(
x
,
y
))
couple_enfant
=
enfant
(
x
,
y
)
newself
.
append
(
couple_enfant
[
0
])
newself
.
append
(
couple_enfant
[
1
])
self
=
self
.
modifier_population
(
newself
)
self
=
self
.
modifier_population
(
newself
)
def
afficher
(
popu
):
def
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