From 75cbb1bcaf35a130858de8d03ce70bafc604e5bb Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 12 Jun 2011 17:59:44 +0200 Subject: [PATCH] UCT reportfreq: Implement --- uct/internal.h | 1 + uct/search.c | 5 +---- uct/uct.c | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/uct/internal.h b/uct/internal.h index fa929f3..7ac752b 100644 --- a/uct/internal.h +++ b/uct/internal.h @@ -31,6 +31,7 @@ struct uct { UR_JSON, UR_JSON_BIG, } reporting; + int reportfreq; int games, gamelen; floating_t resign_threshold, sure_win_threshold; diff --git a/uct/search.c b/uct/search.c index 9a006d4..ee31501 100644 --- a/uct/search.c +++ b/uct/search.c @@ -31,9 +31,6 @@ static const struct time_info default_ti = { .len = { .games = MC_GAMES }, }; -/* Once per how many simulations (per thread) to show a progress report line. */ -#define TREE_SIMPROGRESS_INTERVAL 10000 - /* When terminating UCT search early, the safety margin to add to the * remaining playout number estimate when deciding whether the result can * still change. */ @@ -187,7 +184,7 @@ uct_search_start(struct uct *u, struct board *b, enum stone color, { /* Set up search state. */ s->base_playouts = s->last_dynkomi = s->last_print = t->root->u.playouts; - s->print_interval = TREE_SIMPROGRESS_INTERVAL * u->threads; + s->print_interval = u->reportfreq * u->threads; s->fullmem = false; if (ti) { diff --git a/uct/uct.c b/uct/uct.c index 74253e4..0feaaab 100644 --- a/uct/uct.c +++ b/uct/uct.c @@ -531,6 +531,7 @@ uct_state_init(char *arg, struct board *b) struct uct *u = calloc2(1, sizeof(struct uct)); u->debug_level = debug_level; + u->reportfreq = 10000; u->gamelen = MC_GAMELEN; u->resign_threshold = 0.2; u->sure_win_threshold = 0.85; @@ -609,6 +610,10 @@ uct_state_init(char *arg, struct board *b) fprintf(stderr, "UCT: Invalid reporting format %s\n", optval); exit(1); } + } else if (!strcasecmp(optname, "reportfreq") && optval) { + /* The progress information line will be shown + * every simulations. */ + u->reportfreq = atoi(optval); } else if (!strcasecmp(optname, "dumpthres") && optval) { /* When dumping the UCT tree on output, include * nodes with at least this many playouts. -- 2.11.4.GIT