DEBUG flags cleanup, some dead code removal
This commit is contained in:
26
best.c
26
best.c
@@ -7,35 +7,24 @@
|
||||
#include "lceb.h"
|
||||
|
||||
static int target=0;
|
||||
//static int best=MAXINT;
|
||||
static int bestdiff=MAXINT;
|
||||
static int bestops=MAXINT;
|
||||
|
||||
static BEST bests[1024*10]; /* TODO: should be dynamic */
|
||||
static int nbests=0;
|
||||
extern int displaytimer;
|
||||
int sigint_received=0;
|
||||
int displayintermediate=0;
|
||||
int displaytype=0;
|
||||
|
||||
#define DIFF(a, b) ((a)>(b)?(a)-(b):(b)-(a))
|
||||
|
||||
void stopall()
|
||||
{
|
||||
printf("SIGINT RECEIVED: aborting eval\n");
|
||||
sigint_received=1;
|
||||
}
|
||||
|
||||
int stopped()
|
||||
{
|
||||
return sigint_received;
|
||||
}
|
||||
|
||||
void set_target(n)
|
||||
int n;
|
||||
{
|
||||
target=n;
|
||||
signal(SIGINT, stopall);
|
||||
# ifdef DEBUG
|
||||
printf("target assigned (%d).\n", target);
|
||||
# endif
|
||||
}
|
||||
|
||||
int check_best(res, nops, node, values, ops)
|
||||
@@ -81,7 +70,6 @@ int check_best(res, nops, node, values, ops)
|
||||
}
|
||||
# endif
|
||||
}
|
||||
//}
|
||||
if (found) {
|
||||
set_timer(&(bests[nbests].timer));
|
||||
bests[nbests].res=res;
|
||||
@@ -90,7 +78,6 @@ int check_best(res, nops, node, values, ops)
|
||||
bests[nbests].oper=ops;
|
||||
bests[nbests].root=dup_node(node);
|
||||
bests[nbests].values=values;
|
||||
// printf("NEW BEST! res=%d diff=%d nops=%d\n", res, diff, nops);
|
||||
if (displayintermediate) {
|
||||
if (displaytimer) {
|
||||
printf("%.5f secs: ", get_timer(bests[nbests].timer));
|
||||
@@ -99,7 +86,6 @@ int check_best(res, nops, node, values, ops)
|
||||
print_node(node, TREE_TOP, 0, displaytype);
|
||||
putchar('\n');
|
||||
}
|
||||
//printf("check_best: res=%d diff=%d nops=%d\n", res, diff, nops);
|
||||
nbests++;
|
||||
return diff;
|
||||
}
|
||||
@@ -136,12 +122,14 @@ void print_bests()
|
||||
{
|
||||
int i=0;
|
||||
printf("BEST SOLUTION: res=%d diff=%d ops=%d ", bests[i].res, bestdiff, bestops);
|
||||
if (displaytimer)
|
||||
printf("after %.5f secs.", get_timer(bests[i].timer));
|
||||
//if (displaytimer)
|
||||
printf("found after %.5f secs.", get_timer(bests[i].timer));
|
||||
putchar('\n');
|
||||
for (i=0; i<nbests; ++i) {
|
||||
//print_best(bests[i].root, bests[i].values, bests[i].oper, 0);
|
||||
//printf("%5d =", bests[i].res);
|
||||
if (displaytimer)
|
||||
printf("%.5f secs: ", get_timer(bests[i].timer));
|
||||
print_node(bests[i].root, TREE_TOP, 0, displaytype);
|
||||
putchar('\n');
|
||||
//printf("%3d: %d = ", i, bests[i].res);
|
||||
|
Reference in New Issue
Block a user