added timer for maxed calculation time.

This commit is contained in:
2021-01-27 13:56:03 +01:00
parent fb297756b6
commit c6851b22c0
6 changed files with 57 additions and 19 deletions

14
best.c
View File

@@ -12,7 +12,7 @@ static int bestops=MAXINT;
static BEST bests[1024*10]; /* TODO: should be dynamic */
static int nbests=0;
extern int displaytimer;
extern int displaytimer, firstonly;
int displayintermediate=0;
int displaytype=0;
@@ -120,12 +120,16 @@ void print_best(node, values, pops, depth)
void print_bests()
{
int i=0;
printf("BEST SOLUTION: res=%d diff=%d ops=%d ", bests[i].res, bestdiff, bestops);
int i=0, j=firstonly? 1: nbests;
if (bestdiff==0) {
printf("Le compte est bon: %d solutions with %d ops ", nbests, bestops);
} else {
printf("Found %d results with difference %d and %d ops ", nbests, bestdiff, bestops);
}
//if (displaytimer)
printf("found after %.5f secs.", get_timer(bests[i].timer));
printf("(1st after %.5f secs).", get_timer(bests[i].timer));
putchar('\n');
for (i=0; i<nbests; ++i) {
for (i=0; i<j; ++i) {
//print_best(bests[i].root, bests[i].values, bests[i].oper, 0);
//printf("%5d =", bests[i].res);
if (displaytimer)