]> mj.ucw.cz Git - leo.git/commitdiff
Labelling: Bugfixes in get_closure labelling
authorKarolina Buresova <karry@kam.mff.cuni.cz>
Sun, 26 Jul 2015 00:17:28 +0000 (02:17 +0200)
committerKarolina Buresova <karry@kam.mff.cuni.cz>
Sun, 26 Jul 2015 00:17:28 +0000 (02:17 +0200)
Ooops

lab-bitmaps.c
lab-bitmaps.h
lab-evolution.c

index f5822e6f4b9c257b6fe01c6ef918e9776492022d..51d1da847623d12f17944dae19e0b098ccfa5ddf 100644 (file)
@@ -21,7 +21,7 @@ static void make_bitmap_label(struct variant *v, struct sym_text *text);
 static int overlaps(struct placement *p1, struct placement *p2);
 
 static struct map_part **get_map_parts(struct placement *p);
-static struct placement **get_overlapping(struct placement *p);
+static struct placement **get_overlapping_in(struct placement *p, struct individual *individual);
 
 double bitmap_granularity = 1;
 
@@ -266,7 +266,7 @@ void update_map_parts(struct placement *p)
   update_map_parts_create(p);
 }
 
-struct placement **get_closure(struct placement *placement)
+struct placement **get_closure(struct placement *placement, struct individual *other)
 {
   struct placement **closure;
   GARY_INIT(closure, 0);
@@ -280,7 +280,7 @@ struct placement **get_closure(struct placement *placement)
   while (first < GARY_SIZE(closure))
   {
     DEBUG(dbg_breeding, VERBOSITY_ALL, "Iterating, first is %u of current %zu\n", first, GARY_SIZE(closure));
-    struct placement **overlapping = get_overlapping(placement);
+    struct placement **overlapping = get_overlapping_in(closure[first], other);
     if (! overlapping) { first++; continue; }
 
     struct placement **filtered = filter(overlapping, &chosen);
@@ -293,7 +293,8 @@ struct placement **get_closure(struct placement *placement)
       {
         if (overlaps(*p, overlapping[j]))
         {
-         p = GARY_PUSH(closure); *p = overlapping[j];
+         p = GARY_PUSH(closure);
+         *p = &(placement->individual->placements[overlapping[j]->request->ind]);
          DEBUG(dbg_breeding, VERBOSITY_ALL, "Adding placement of request %d (in fact at [%.2f; %.2f] of size %d x %d)\n", overlapping[j]->request->ind, overlapping[j]->x, overlapping[j]->y, overlapping[j]->request->variants[overlapping[j]->variant_used].width, overlapping[j]->request->variants[overlapping[j]->variant_used].height);
          chosen[overlapping[j]->request->ind] = 1;
        }
@@ -308,7 +309,7 @@ struct placement **get_closure(struct placement *placement)
   return closure;
 }
 
-static struct placement **get_overlapping(struct placement *p)
+static struct placement **get_overlapping_in(struct placement *p, struct individual *individual)
 {
   struct placement **buffer;
   GARY_INIT(buffer, 0);
@@ -318,7 +319,7 @@ static struct placement **get_overlapping(struct placement *p)
 
   for (uns i=0; i<GARY_SIZE(parts); i++)
   {
-    struct map_placement *mp = parts[i]->placement->next_in_map;
+    struct map_placement *mp = individual->map[parts[i]->ind]->placement->next_in_map;
     while (mp)
     {
       if (p->variant_used >= 0)
index b1782727dad9ef50a0bb1b834c4d77bb404225f1..c4b1676addf150d9a02ea2f0531d79ad023ac63a 100644 (file)
@@ -8,7 +8,7 @@ int get_overlap(struct placement *p, int **planed_ptr, int iteration);
 void update_map_parts(struct placement *p);
 void update_map_parts_delete(struct placement *p);
 void update_map_parts_create(struct placement *p);
-struct placement **get_closure(struct placement *placement);
+struct placement **get_closure(struct placement *placement, struct individual *other);
 
 void dump_bitmaps(struct individual *individual);
 void dump_label(struct symbol *sym);
index 169a9bc0aa7ccfffa087786a0fd6823a9aace8a0..8f91446c8caaf08635f95ae64eb5e75bc482f602 100644 (file)
@@ -457,7 +457,7 @@ static struct individual **perform_crossover(struct individual *parent1, struct
     {
       DEBUG(dbg_breeding, VERBOSITY_PLACEMENT, "Creating symbol closure for placement %u\n", i);
 
-      struct placement **clos_symbols = get_closure(&(parent1->placements[i]));
+      struct placement **clos_symbols = get_closure(&(parent1->placements[i]), parent2);
       int x = randint(0, 2);
 
       if (x == 0)