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
8ea8b1c0
Commit
8ea8b1c0
authored
5 years ago
by
Gauthier Roy
Browse files
Options
Downloads
Plain Diff
merge with carlos branch
parents
69e8a061
eaf11a4e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
__pycache__/RotTable.cpython-36.pyc
+0
-0
0 additions, 0 deletions
__pycache__/RotTable.cpython-36.pyc
algogenetique.py
+2
-3
2 additions, 3 deletions
algogenetique.py
individu.py
+17
-16
17 additions, 16 deletions
individu.py
population.py
+2
-2
2 additions, 2 deletions
population.py
with
21 additions
and
21 deletions
__pycache__/RotTable.cpython-36.pyc
+
0
−
0
View file @
8ea8b1c0
No preview for this file type
This diff is collapsed.
Click to expand it.
algogenetique.py
+
2
−
3
View file @
8ea8b1c0
...
@@ -8,14 +8,14 @@ import croisement
...
@@ -8,14 +8,14 @@ import croisement
from
Traj3D
import
*
from
Traj3D
import
*
from
random
import
random
from
random
import
random
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
time
import
time
# Debut du decompte du temps
# Debut du decompte du temps
start_time
=
time
.
time
()
start_time
=
time
.
time
()
def
main
(
N
,
tmax
,
pmutation
,
proportion
):
def
main
(
N
,
tmax
,
pmutation
,
proportion
):
L
=
[]
L
=
[]
lineList
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
"
plasmid_8k.fasta
"
)]
lineList
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
"
plasmid_8k.fasta
"
)]
brin
=
''
.
join
(
lineList
[
1
:])
brin
=
''
.
join
(
lineList
[
1
:])
...
@@ -35,7 +35,6 @@ def main(N,tmax,pmutation, proportion):
...
@@ -35,7 +35,6 @@ def main(N,tmax,pmutation, proportion):
best
=
individu
best
=
individu
mini
=
individu
.
score
mini
=
individu
.
score
L
.
append
(
mini
)
L
.
append
(
mini
)
plt
.
subplot
(
221
)
plt
.
subplot
(
221
)
plt
.
plot
([
i
for
i
in
range
(
tmax
)],
L
)
plt
.
plot
([
i
for
i
in
range
(
tmax
)],
L
)
...
...
This diff is collapsed.
Click to expand it.
individu.py
+
17
−
16
View file @
8ea8b1c0
...
@@ -9,37 +9,38 @@ P1 = 0.015
...
@@ -9,37 +9,38 @@ P1 = 0.015
class
Individu
():
class
Individu
():
def
__init__
(
self
,
table
):
def
__init__
(
self
,
table
):
lineList
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
"
plasmid_8k.fasta
"
)]
brin
=
''
.
join
(
lineList
[
1
:])
self
.
table
=
table
self
.
table
=
table
self
.
score
=
self
.
evaluate
(
"
AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA
"
)
self
.
score
=
inf
def
evaluate
(
self
,
brin
):
def
evaluate
(
self
,
brin
):
traj
=
Traj3D
()
traj
=
Traj3D
()
numb_ajout
=
3
numb_ajout
=
6
fisrt_seq
=
brin
[
0
:
numb_ajout
]
fisrt_seq
=
brin
[
0
:
numb_ajout
]
last_seq
=
brin
[
-
numb_ajout
:]
last_seq
=
brin
[
-
numb_ajout
:]
traj
.
compute
(
last_seq
+
brin
+
fisrt_seq
,
self
.
table
)
traj
.
compute
(
last_seq
+
brin
+
fisrt_seq
,
self
.
table
)
traj_array
=
np
.
array
(
traj
.
getTraj
())
traj_array
=
np
.
array
(
traj
.
getTraj
())
list_distance
=
[]
list_distance
=
[]
for
i
in
range
(
numb_ajout
):
begining
=
traj_array
[
0
:
2
*
numb_ajout
,
0
:
3
]
first_nuc_coordonate
=
traj_array
[
numb_ajout
+
i
,
0
:
3
]
end
=
traj_array
[
-
2
*
numb_ajout
:,
0
:
3
]
first_nuc_coordonate_compute
=
traj_array
[
-
(
numb_ajout
-
i
),
0
:
3
]
last_nuc_coordonate
=
traj_array
[
-
(
2
*
numb_ajout
-
i
),
0
:
3
]
last_nuc_coordonate_compute
=
traj_array
[
i
,
0
:
3
]
distance_first_nuc
=
np
.
linalg
.
norm
(
first_nuc_coordonate
-
first_nuc_coordonate_compute
,
ord
=
2
)
for
i
in
range
(
numb_ajout
):
distance_last_nuc
=
np
.
linalg
.
norm
(
last_nuc_coordonate
-
last_nuc_coordonate_compute
,
ord
=
2
)
list_distance
+=
[
distance_first_nuc
,
distance_last_nuc
]
nuc_coordonate_beg
=
begining
[
i
]
nuc_coordonate_end
=
end
[
i
]
distance_nuc
=
np
.
linalg
.
norm
(
nuc_coordonate_beg
-
nuc_coordonate_end
,
ord
=
2
)
list_distance
+=
[
distance_nuc
]
self
.
score
=
max
(
list_distance
)
self
.
score
=
max
(
list_distance
)
return
max
(
list_distance
)
#
return max(list_distance)
def
mutation
(
self
,
proba
=
P1
):
def
mutation
(
self
,
proba
=
P1
):
...
@@ -61,10 +62,10 @@ class Individu():
...
@@ -61,10 +62,10 @@ class Individu():
# print(individu1.table.rot_table)
# print(individu1.table.rot_table)
# individu1.mutation()
# individu1.mutation()
#
table = RotTable()
table
=
RotTable
()
#
test = Individu(table)
test
=
Individu
(
table
)
#
test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
test
.
evaluate
(
"
AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA
"
)
#
print(test.score)
print
(
test
.
score
)
# qqun=Individu(RotTable())
# qqun=Individu(RotTable())
...
...
This diff is collapsed.
Click to expand it.
population.py
+
2
−
2
View file @
8ea8b1c0
...
@@ -68,7 +68,7 @@ class Population:
...
@@ -68,7 +68,7 @@ class Population:
meilleur
=
self
.
indiv
[
0
]
meilleur
=
self
.
indiv
[
0
]
for
individu
in
self
.
indiv
:
for
individu
in
self
.
indiv
:
if
meilleur
.
score
>
individu
.
score
:
if
meilleur
.
score
>
individu
.
score
:
print
(
"
meilleur, individu:
"
,
meilleur
.
score
,
individu
.
score
)
#
print("meilleur, individu: ", meilleur.score, individu.score)
meilleur
=
individu
meilleur
=
individu
newself
=
[
meilleur
]
newself
=
[
meilleur
]
vu
=
set
()
vu
=
set
()
...
@@ -83,7 +83,7 @@ class Population:
...
@@ -83,7 +83,7 @@ class Population:
x
=
self
.
indiv
[
m
]
x
=
self
.
indiv
[
m
]
y
=
self
.
indiv
[
t
]
y
=
self
.
indiv
[
t
]
if
x
.
score
<
y
.
score
:
if
x
.
score
<
=
y
.
score
:
newself
.
append
(
x
)
newself
.
append
(
x
)
else
:
else
:
newself
.
append
(
y
)
newself
.
append
(
y
)
...
...
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