From 421c57a15df6c1d1609b9902b8f8cc3067b6149c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 7 Mar 2014 16:28:26 +0000 Subject: [PATCH 1/1] less printing, optimise --- Makefile | 2 +- main.c | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index e91ae03..5c571d2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS += -Wall -Wwrite-strings -Wstrict-prototypes -g +CFLAGS += -Wall -Wwrite-strings -Wstrict-prototypes -g -O2 LC_CTYPE=C LDLIBS = -lpub -lglpk diff --git a/main.c b/main.c index f8348cb..94baac7 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,8 @@ static double best; static glp_prob *best_prob; static AdjWord *best_adjmatrix; +static unsigned printcounter; + static AdjWord *xalloc_adjmatrix(void) { return xmalloc(sizeof(*adjmatrix)*n); } @@ -41,17 +43,17 @@ static int count_set_adj_bits(AdjWord w) { return total; } -static void optimise(void) { +static void optimise(int doprint) { glp_prob *prob = 0; int i, j, totalfrags; for (i=0, totalfrags=0; i= n) { - optimise(); + printcounter++; + optimise(!(printcounter & 0xfff)); return; } for (adjmatrix[i] = min; -- 2.30.2