]> mj.ucw.cz Git - leo.git/commitdiff
Labelling: make_population and copy_individual fixes
authorKarryanna <karry@karryanna.cz>
Wed, 13 May 2015 16:51:25 +0000 (18:51 +0200)
committerKarryanna <karry@karryanna.cz>
Wed, 13 May 2015 16:51:25 +0000 (18:51 +0200)
labeller.c

index f2792ee091b8912e17e1328abc88c50761c88db6..1db25fca59721a57be2199c4e79154de98772460 100644 (file)
@@ -1074,6 +1074,10 @@ void make_population(void)
 {
   for (int i=0; i<conf_pop_size; i++)
   {
 {
   for (int i=0; i<conf_pop_size; i++)
   {
+    struct individual *i2 = ep_alloc(ep_individuals);
+    init_individual(i2);
+    population2[i] = i2;
+
     if (dbg_init)
       printf("Making individual %d\n", i);
     struct individual *individual = ep_alloc(ep_individuals); init_individual(individual);
     if (dbg_init)
       printf("Making individual %d\n", i);
     struct individual *individual = ep_alloc(ep_individuals); init_individual(individual);
@@ -1723,10 +1727,19 @@ void cleanup(void)
 
 void copy_individual(struct individual *src, struct individual *dest)
 {
 
 void copy_individual(struct individual *src, struct individual *dest)
 {
-  src->penalty = dest->penalty;
+  dest->penalty = src->penalty;
   GARY_INIT(dest->placements, GARY_SIZE(src->placements));
   for (uns i=0; i<GARY_SIZE(src->placements); i++)
   {
     dest->placements[i] = src->placements[i];
   GARY_INIT(dest->placements, GARY_SIZE(src->placements));
   for (uns i=0; i<GARY_SIZE(src->placements); i++)
   {
     dest->placements[i] = src->placements[i];
+    dest->placements[i].map_links = NULL;
+  }
+  for (uns j=0; j<num_map_parts; j++)
+  {
+    struct map_part *part = GARY_PUSH(dest->map);
+    GARY_INIT(part->placement, 0);
+    struct map_placement *mp = GARY_PUSH(part->placement);
+    mp->placement = &dummy_placement;
+    mp->next = mp->prev = NULL;
   }
 }
   }
 }