Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LIN Julien
sho
Commits
51879371
Commit
51879371
authored
Oct 11, 2021
by
Julien Lin
Browse files
add coefficient for evolutionnary algo
parent
ff5a1a10
Changes
2
Hide whitespace changes
Inline
Side-by-side
num_evolutionary_660.png
0 → 100644
View file @
51879371
15.4 KB
snp.py
View file @
51879371
...
...
@@ -371,7 +371,20 @@ def main(args=None):
if
should_plot
:
plot_sol
(
the
,
history
,
sensors
,
shape
)
return
val
,
len
(
history
),
sol
,
sensors
# coefficient when objective function is called multiples times in one epoch
coef
=
get_coef_objective_func
(
the
)
# constant when objective function is called multiples times in one epoch
initial
=
get_constant_objectiv_func
(
the
)
return
val
,
len
(
history
)
*
coef
+
initial
,
sol
,
sensors
def
get_constant_objectiv_func
(
the
):
return
the
.
nb_population
if
the
.
solver
==
"num_evolutionary"
else
0
def
get_coef_objective_func
(
the
):
return
the
.
nb_selected
*
the
.
nb_offspring
if
the
.
solver
==
"num_evolutionary"
else
1
if
__name__
==
"__main__"
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment