Commit 51879371 authored by Julien Lin's avatar Julien Lin
Browse files

add coefficient for evolutionnary algo

parent ff5a1a10
......@@ -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__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment