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
0069971f
Commit
0069971f
authored
May 07, 2018
by
David A.. Werner
Browse files
Added property access to survival rates
parent
15d07009
Changes
1
Hide whitespace changes
Inline
Side-by-side
manduca/Population.py
View file @
0069971f
...
...
@@ -13,6 +13,24 @@ class GenerationInfo(namedtuple('GenerationInfo', ['generation_number', 'fitness
def
max_fitness
(
self
):
return
max
(
self
.
fitness_values
)
@
property
def
child_survival_rate
(
self
):
if
self
.
num_matings
is
None
:
return
None
return
float
(
self
.
surviving_children
)
/
self
.
num_matings
@
property
def
mutant_survival_rate
(
self
):
if
self
.
num_mutants
is
None
:
return
None
return
float
(
self
.
surviving_mutants
)
/
self
.
num_mutants
@
property
def
parent_survival_rate
(
self
):
if
self
.
num_ancestors
is
None
:
return
None
return
float
(
self
.
surviving_ancestors
)
/
self
.
num_ancestors
class
EvolutionParameters
(
object
):
def
__init__
(
self
,
max_population
,
num_matings
,
num_mutants
,
max_mutations
,
**
kwargs
):
self
.
max_population
=
max_population
...
...
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