From: Karryanna Date: Tue, 9 Jun 2015 11:07:31 +0000 (+0200) Subject: Labelling: Option to complete population by elitism X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=44f69f697bae64aaa263301ea3b7df1461be9e87;p=leo.git Labelling: Option to complete population by elitism Mostly a hot-fix to situation when rounding causes the sum of individuals created by specific methods not to fit the desired population size --- diff --git a/labeller.c b/labeller.c index bfd6751..644fa77 100644 --- a/labeller.c +++ b/labeller.c @@ -60,6 +60,7 @@ int num_edges = 0; int dbg_num_hits = 0; int conf_pop_size = 50; +int conf_fit_size = 1; int conf_penalty_bound = 0; int conf_stagnation_bound = 0; @@ -1095,9 +1096,16 @@ void compute_sizes(void) if (breed_pop_size + mutate_pop_size + elite_pop_size != conf_pop_size) { - fprintf(stderr, "Breeding + mutation + elitism won't create correct number of individuals\n"); - fprintf(stderr, "Please fix conf_breed_pop_size, conf_mutate_pop_size and conf_elite_pop_size parameters\n"); - exit(2); + if (conf_fit_size) + { + elite_pop_size += conf_pop_size - (breed_pop_size + mutate_pop_size + elite_pop_size); + } + else + { + fprintf(stderr, "Breeding + mutation + elitism won't create correct number of individuals\n"); + fprintf(stderr, "Please fix conf_breed_pop_size, conf_mutate_pop_size and conf_elite_pop_size parameters\n"); + exit(2); + } } }