From 502873ccf62c4b63f1506c02b8f3e9096f682195 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 8 Mar 2014 17:31:36 +0000 Subject: [PATCH 1/1] break out preconsider_ok --- main.c | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/main.c b/main.c index 4ec4935..f9402cf 100644 --- a/main.c +++ b/main.c @@ -112,33 +112,17 @@ static int count_set_adj_bits(AdjWord w) { return total; } -static void optimise(int doprint) { - /* Consider the best answer (if any) for a given adjacency matrix */ - glp_prob *prob = 0; - int i, j, totalfrags; +#define PRINTF(...) if (!doprint) ; else fprintf(stderr, __VA_ARGS__) - /* - * Up to a certain point, optimise() can be restarted. We use this - * to go back and print the debugging output if it turns out that we - * have an interesting case. The HAVE_PRINTED macro does this: its - * semantics are to go back in time and make sure that we have - * printed the description of the search case. - */ -#define HAVE_PRINTED ({ \ - if (!doprint) { doprint = 1; goto retry_with_print; } \ - }) - retry_with_print: - if (prob) { - glp_delete_prob(prob); - prob = 0; - } +static int totalfrags; -#define PRINTF(...) if (!doprint) ; else fprintf(stderr, __VA_ARGS__) +static bool preconsider_ok(int nwords, bool doprint) { + int i; PRINTF("%2d ", maxhamweight); bool had_max = 0; - for (i=0, totalfrags=0; i