From: Karryanna Date: Wed, 13 May 2015 21:54:57 +0000 (+0200) Subject: Labelling: Introducing new enum for verbosity X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c06156f33a08f36aaaee69d1e202912a2a612c6d;p=leo.git Labelling: Introducing new enum for verbosity --- diff --git a/labeller.c b/labeller.c index 5348737..58fa844 100644 --- a/labeller.c +++ b/labeller.c @@ -41,19 +41,19 @@ struct eltpool *ep_individuals; struct individual **population1; struct individual **population2; -int dbg_segments = 0; -int dbg_plan = 0; -int dbg_requests = 0; -int dbg_graph = 0; -int dbg_bfs = 0; -int dbg_map_parts = 0; -int dbg_movement = 0; -int dbg_init = 0; -int dbg_overlaps = 0; -int dbg_rank = 0; -int dbg_evolution = 0; -int dbg_mutation = 0; -int dbg_breeding = 0; +int dbg_segments = VERBOSITY_NONE; +int dbg_plan = VERBOSITY_NONE; +int dbg_requests = VERBOSITY_NONE; +int dbg_graph = VERBOSITY_NONE; +int dbg_bfs = VERBOSITY_NONE; +int dbg_map_parts = VERBOSITY_NONE; +int dbg_movement = VERBOSITY_NONE; +int dbg_init = VERBOSITY_NONE; +int dbg_overlaps = VERBOSITY_NONE; +int dbg_rank = VERBOSITY_NONE; +int dbg_evolution = VERBOSITY_NONE; +int dbg_mutation = VERBOSITY_NONE; +int dbg_breeding = VERBOSITY_NONE; int page_width_int; int page_height_int; @@ -1184,7 +1184,7 @@ void breed(void) { int parent1 = randint(0, breed_rbest_size-1); int parent2 = randint(0, breed_rbest_size-1); - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_INDIVIDUAL) printf("Will breed %d and %d\n", parent1, parent2); breed_buffer = perform_crossover(population1[parent1], population1[parent2]); @@ -1210,7 +1210,7 @@ struct individual **perform_crossover(struct individual *parent1, struct individ { if (! processed[parent1->placements[i].ind]) { - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_PLACEMENT) printf("Creating symbol closure for placement %u\n", i); struct placement **clos_symbols = get_closure(&(parent1->placements[i])); @@ -1218,14 +1218,14 @@ struct individual **perform_crossover(struct individual *parent1, struct individ if (x == 1) { - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_PLACEMENT) printf("Copying parent->child 1->1 and 2->2\n"); copy_symbols(clos_symbols, parent1, child1, &processed); copy_symbols(clos_symbols, parent2, child2, &processed); } else { - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_PLACEMENT) printf("Copying parent->child 2->1 and 1->2\n"); copy_symbols(clos_symbols, parent2, child1, &processed); copy_symbols(clos_symbols, parent1, child2, &processed); @@ -1623,13 +1623,13 @@ struct placement **get_closure(struct placement *placement) uns first = 0; while (first < GARY_SIZE(closure)) { - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_ALL) printf("Iterating, first is %d of current %u\n", first, GARY_SIZE(closure)); struct placement **overlapping = get_overlapping(placement); if (! overlapping) { first++; continue; } struct placement **filtered = filter(overlapping, &chosen); - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_ALL) printf("There are %u new overlapping symbols\n", GARY_SIZE(filtered)); GARY_FREE(overlapping); overlapping = filtered; @@ -1640,7 +1640,7 @@ struct placement **get_closure(struct placement *placement) if (overlaps(*p, overlapping[j])) { p = GARY_PUSH(closure); *p = overlapping[j]; - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_ALL) printf("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; } @@ -1656,7 +1656,7 @@ struct placement **get_closure(struct placement *placement) void copy_symbols(struct placement **closure, struct individual *parent, struct individual *child, bool **processed_ptr) { bool *processed = *processed_ptr; - if (dbg_breeding) + if (dbg_breeding >= VERBOSITY_ALL) printf("Will copy %u symbols\n", GARY_SIZE(closure)); for (uns i=0; i