From a32cc02cce236a5dc1a8995d7d9f638c81401ea6 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 6 Apr 2008 12:42:56 +0200 Subject: [PATCH] UCT: Some commented-out debug prints --- uct/policy/ucb1.c | 6 ++++++ uct/tree.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/uct/policy/ucb1.c b/uct/policy/ucb1.c index 67f36b8..5baa250 100644 --- a/uct/policy/ucb1.c +++ b/uct/policy/ucb1.c @@ -66,6 +66,12 @@ ucb1_descend(struct uct_policy *p, struct tree *tree, struct tree_node *node, in ni->prior.value = (float)ni->prior.wins / ni->prior.playouts; float priorp = (parity > 0 ? ni->prior.value : 1- ni->prior.value); float urgency = ni->u.playouts ? (parity > 0 ? ni->u.value : 1 - ni->u.value) + sqrt(xpl / ni->u.playouts) : ni->prior.playouts ? priorp : b->fpu; +#if 0 + { + struct board b2; b2.size = 9; + fprintf(stderr, "[%s -> %s] UCB1 urgency %f (%f + %f : %f : %f)\n", coord2sstr(node->coord, &b2), coord2sstr(ni->coord, &b2), urgency, ni->u.value, sqrt(xpl / ni->u.playouts), priorp, b->fpu); + } +#endif if (urgency > best_urgency) { best_urgency = urgency; nbest = ni; diff --git a/uct/tree.c b/uct/tree.c index 633eb15..16a67c6 100644 --- a/uct/tree.c +++ b/uct/tree.c @@ -154,4 +154,8 @@ tree_update_node_value(struct tree_node *node, bool add_amaf) { node->u.value = (float)(node->u.wins + node->prior.wins + (add_amaf ? node->amaf.wins : 0)) / (node->u.playouts + node->prior.playouts + (add_amaf ? node->amaf.playouts : 0)); +#if 0 + { struct board b2; b2.size = 9; + fprintf(stderr, "%s->%s %d/%d %d/%d %f\n", node->parent ? coord2sstr(node->parent->coord, &b2) : NULL, coord2sstr(node->coord, &b2), node->u.wins, node->u.playouts, node->prior.wins, node->prior.playouts, node->u.value); } +#endif } -- 2.11.4.GIT