]> mj.ucw.cz Git - leo.git/commitdiff
Labelling: Weights in rankings are configurable
authorKarryanna <karry@karryanna.cz>
Thu, 23 Jul 2015 15:50:50 +0000 (17:50 +0200)
committerKarryanna <karry@karryanna.cz>
Thu, 23 Jul 2015 15:50:50 +0000 (17:50 +0200)
lab-evolution.c
map.cf

index 197862495d85feae26767a8578b2da4825a4f028..169a9bc0aa7ccfffa087786a0fd6823a9aace8a0 100644 (file)
@@ -78,6 +78,8 @@ static int conf_pop_size = 200, conf_fit_size = 1, conf_term_cond = TERM_COND_IT
 static double conf_penalty_bound = 100, conf_stagnation_bound = 10;
 static int conf_iteration_limit = 200;
 
+static double conf_rank_distance_w = 1, conf_rank_overlap_w = 1, conf_rank_omittment_w = 1;
+
 static int breed_pop_size;
 static int breed_rbest_size;
 
@@ -113,6 +115,9 @@ static struct cf_section evolution_cf = {
     CF_DOUBLE("MutateRegenBound", &conf_mutate_regen_bound),
     CF_DOUBLE("MutateChvarBound", &conf_mutate_chvar_bound),
     CF_DOUBLE("ElitePopSize", &conf_elite_pop_size),
+    CF_DOUBLE("DistanceWeight", &conf_rank_distance_w),
+    CF_DOUBLE("OverlapWeight", &conf_rank_overlap_w),
+    CF_DOUBLE("OmittmentWeight", &conf_rank_omittment_w),
     CF_END
   }
 };
@@ -577,15 +582,15 @@ static void rank_population(void)
     DEBUG(dbg_rank, VERBOSITY_INDIVIDUAL, "Individual %d\n", i);
     population1[i]->penalty = 0;
 
-    penalty = individual_omittment(population1[i]);
+    penalty = conf_rank_omittment_w * individual_omittment(population1[i]);
     DEBUG(dbg_rank, VERBOSITY_INDIVIDUAL, "Increasing penalty by %d for omittment\n", penalty);
     population1[i]->penalty += penalty;
 
-    penalty = individual_overlap(population1[i]);
+    penalty = conf_rank_overlap_w * individual_overlap(population1[i]);
     DEBUG(dbg_rank, VERBOSITY_INDIVIDUAL, "Increasing penalty by %d for overlap\n", penalty);
     population1[i]->penalty += penalty;
 
-    penalty = individual_distances(population1[i]);
+    penalty = conf_rank_distance_w * individual_distances(population1[i]);
     DEBUG(dbg_rank, VERBOSITY_INDIVIDUAL, "Increasing penalty by %d for distances\n", penalty);
     population1[i]->penalty += penalty;
   }
diff --git a/map.cf b/map.cf
index ab93d5e6d4bbef8bbaac3f6ed822acde71387059..3f3a70b8eb85f0ef53988a321cf3b95f0cc00bb2 100644 (file)
--- a/map.cf
+++ b/map.cf
@@ -90,6 +90,11 @@ Evolution {
        StagnationBound 10
        IterationLimit 200
 
+       # Ranking parameters
+       DistanceWeight  1
+       OmittmentWeight 1
+       OverlapWeight   1
+
        # Create that part of generation by breeding
        BreedPopSize 0.45
        # Use that part of best individuals for parent selection