From 43eac47b5c1640bf072ab3c4c429bda6e2be7fe5 Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Sat, 27 Aug 2011 13:58:49 +0200 Subject: [PATCH] UCB1AMAF: set distance_rave=3 by default, adapt equiv_rave & cfgd accordingly This change gains about 40 elo on large configurations (16 cores), but only if equiv_rave is changed at the same time as distance_rave. --- uct/policy/ucb1amaf.c | 7 ++++--- uct/prior.c | 7 +++---- uct/uct.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/uct/policy/ucb1amaf.c b/uct/policy/ucb1amaf.c index 7621daa..e3f377c 100644 --- a/uct/policy/ucb1amaf.c +++ b/uct/policy/ucb1amaf.c @@ -290,7 +290,7 @@ ucb1amaf_update(struct uct_policy *p, struct tree *tree, struct tree_node *node, struct uct_policy * -policy_ucb1amaf_init(struct uct *u, char *arg) +policy_ucb1amaf_init(struct uct *u, char *arg, struct board *board) { struct uct_policy *p = calloc2(1, sizeof(*p)); struct ucb1_policy_amaf *b = calloc2(1, sizeof(*b)); @@ -303,10 +303,11 @@ policy_ucb1amaf_init(struct uct *u, char *arg) p->update = ucb1amaf_update; p->wants_amaf = true; - b->explore_p = 0; // 0.02 can be also good on 19x19 with prior=eqex=40 - b->equiv_rave = 3000; + b->explore_p = 0; + b->equiv_rave = board_large(board) ? 4000 : 3000; b->fpu = INFINITY; b->sylvain_rave = true; + b->distance_rave = 3; b->ltree_rave = 0.75f; b->crit_rave = 1.1f; diff --git a/uct/prior.c b/uct/prior.c index 51409fa..e457b9a 100644 --- a/uct/prior.c +++ b/uct/prior.c @@ -241,12 +241,11 @@ uct_prior_init(char *arg, struct board *b) if (p->plugin_eqex < 0) p->plugin_eqex = p->eqex * -p->plugin_eqex / 100; if (p->cfgdn < 0) { - const int near = p->eqex*2; - const int far = board_large(b) ? p->eqex*3/2 : p->eqex; - int bonuses[] = { 0, near, far, far }; + static int large_bonuses[] = { 0, 55, 50, 15 }; + static int small_bonuses[] = { 0, 45, 40, 15 }; p->cfgdn = 3; p->cfgd_eqex = calloc2(p->cfgdn + 1, sizeof(*p->cfgd_eqex)); - memcpy(p->cfgd_eqex, bonuses, sizeof(bonuses)); + memcpy(p->cfgd_eqex, board_large(b) ? large_bonuses : small_bonuses, sizeof(large_bonuses)); } if (p->cfgdn > TREE_NODE_D_MAX) { fprintf(stderr, "uct: CFG distances only up to %d available\n", TREE_NODE_D_MAX); diff --git a/uct/uct.c b/uct/uct.c index 03a743e..6a2d748 100644 --- a/uct/uct.c +++ b/uct/uct.c @@ -29,7 +29,7 @@ #include "uct/walk.h" struct uct_policy *policy_ucb1_init(struct uct *u, char *arg); -struct uct_policy *policy_ucb1amaf_init(struct uct *u, char *arg); +struct uct_policy *policy_ucb1amaf_init(struct uct *u, char *arg, struct board *board); static void uct_pondering_start(struct uct *u, struct board *b0, struct tree *t, enum stone color); /* Maximal simulation length. */ @@ -660,7 +660,7 @@ uct_state_init(char *arg, struct board *b) if (!strcasecmp(optval, "ucb1")) { *p = policy_ucb1_init(u, policyarg); } else if (!strcasecmp(optval, "ucb1amaf")) { - *p = policy_ucb1amaf_init(u, policyarg); + *p = policy_ucb1amaf_init(u, policyarg, b); } else { fprintf(stderr, "UCT: Invalid tree policy %s\n", optval); exit(1); @@ -963,7 +963,7 @@ uct_state_init(char *arg, struct board *b) } if (!u->policy) - u->policy = policy_ucb1amaf_init(u, NULL); + u->policy = policy_ucb1amaf_init(u, NULL, b); if (!!u->random_policy_chance ^ !!u->random_policy) { fprintf(stderr, "uct: Only one of random_policy and random_policy_chance is set\n"); -- 2.11.4.GIT