Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander R. Hankin
EE194_Manduca_Simulator
Commits
15d07009
Commit
15d07009
authored
May 07, 2018
by
David A.. Werner
Browse files
Sort population after survival
parent
24af9984
Changes
1
Hide whitespace changes
Inline
Side-by-side
manduca/Population.py
View file @
15d07009
...
...
@@ -164,6 +164,7 @@ class EvolutionSimulator(object):
num_after_survival
=
[
len
(
self
.
population
),
len
(
self
.
_children
),
len
(
self
.
_mutants
)]
self
.
population
=
self
.
population
+
self
.
_children
+
self
.
_mutants
self
.
_children
=
self
.
_mutants
=
[]
self
.
population
.
sort
(
key
=
lambda
val
:
val
.
fitness
,
reverse
=
True
)
return
num_after_survival
def
run_simulation
(
self
,
num_generations
,
history_interval
=
1
,
progress_bar
=
True
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment