gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] semeai and connection depth parameters


From: Arend Bayer
Subject: [gnugo-devel] semeai and connection depth parameters
Date: Tue, 29 Apr 2003 20:23:03 +0200 (CEST)

- adjust connection and semeai depth parameters in set_depth_values()

I've also opted for a somewhat more unified naming, i.e.
semeai_variations and max_nodes_connect are now both called
.._node_limit, as that is the established name (owl_node_limit).

Arend

Index: config.h.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/config.h.in,v
retrieving revision 1.27
diff -u -p -r1.27 config.h.in
--- config.h.in 3 Mar 2003 04:30:50 -0000       1.27
+++ config.h.in 29 Apr 2003 18:16:26 -0000
@@ -18,9 +18,6 @@
 /* Default hash table size in megabytes */
 #undef DEFAULT_MEMORY

-/* Semeai Variations. 500 default */
-#undef DEFAULT_SEMEAI_VARIATIONS
-
 /* Connection module. Default experimental. */
 #undef EXPERIMENTAL_CONNECTIONS

@@ -147,6 +144,9 @@

 /* Allow resignation. Default disabled */
 #undef RESIGNATION_ALLOWED
+
+/* Semeai Variations. 500 default */
+#undef SEMEAI_NODE_LIMIT

 /* The size of a `int', as computed by sizeof. */
 #undef SIZEOF_INT
Index: configure.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/configure.in,v
retrieving revision 1.81
diff -u -p -r1.81 configure.in
--- configure.in        29 Apr 2003 03:17:13 -0000      1.81
+++ configure.in        29 Apr 2003 18:16:32 -0000
@@ -47,7 +47,7 @@ AC_ARG_ENABLE(grid-opt,

 default_cache_size=8
 default_level=10
-default_semeai_variations=500
+default_semeai_node_limit=500
 default_owl_node_limit=1000

 AC_ARG_ENABLE(cache-size,
@@ -56,8 +56,8 @@ AC_ARG_ENABLE(cache-size,
 AC_ARG_ENABLE(level,
   [  --enable-level=n            n = default level (up to 10 supported)])

-AC_ARG_ENABLE(semeai-variations,
-  [  --enable-semeai-variations=n        n = semeai variations (500 standard)])
+AC_ARG_ENABLE(semeai-node-limit,
+  [  --enable-semeai-node-limit=n        n = semeai variations (500 standard)])

 AC_ARG_ENABLE(level,
   [  --enable-owl-node-limit=n           n = owl node limit (1000 standard)])
@@ -359,13 +359,13 @@ fi

 dnl ------------ set semeai variations  ----------

-AH_TEMPLATE([DEFAULT_SEMEAI_VARIATIONS],
+AH_TEMPLATE([SEMEAI_NODE_LIMIT],
 [Semeai Variations. 500 default])

-if test "$enable_semeai_variations" ; then
-   AC_DEFINE_UNQUOTED(DEFAULT_SEMEAI_VARIATIONS, $enable_semeai_variations)
+if test "$enable_semeai_node_limit" ; then
+   AC_DEFINE_UNQUOTED(SEMEAI_NODE_LIMIT, $enable_semeai_node_limit)
 else
-   AC_DEFINE_UNQUOTED(DEFAULT_SEMEAI_VARIATIONS, $default_semeai_variations)
+   AC_DEFINE_UNQUOTED(SEMEAI_NODE_LIMIT, $default_semeai_node_limit)
 fi

 dnl ------------ dfa -------------------
Index: engine/globals.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/globals.c,v
retrieving revision 1.44
diff -u -p -r1.44 globals.c
--- engine/globals.c    28 Apr 2003 17:45:04 -0000      1.44
+++ engine/globals.c    29 Apr 2003 18:16:32 -0000
@@ -78,6 +78,12 @@ int owl_distrust_depth;   /* below this
 int owl_branch_depth;     /* below this owl tries only one variation */
 int owl_reading_depth;    /* owl does not read below this depth */
 int owl_node_limit;       /* maximum number of nodes considered */
+int semeai_branch_depth;
+int semeai_branch_depth2;
+int semeai_node_limit;
+int connect_depth;     /* Used by Tristan Cazenave's connection reader. */
+int connect_depth2;     /* Used by alternater connection reader. */
+int connection_node_limit;
 int mandated_depth;             /* deep reading cut off, mandated value */
 int mandated_backfill_depth;    /* deep reading cut off, mandated value */
 int mandated_backfill2_depth;   /* deep reading cut off, mandated value */
@@ -91,6 +97,7 @@ int mandated_owl_branch_depth;
 int mandated_owl_reading_depth;
 int mandated_owl_node_limit;

+
 /* Miscellaneous. */
 int quiet             = 0;  /* minimal output */
 int showstatistics    = 0;  /* print statistics */
@@ -128,7 +135,6 @@ int doing_scoring              = 0;
 int chinese_rules       = 0;    /* ruleset choice for GMP connection */
 /* use experimental semeai module */
 int experimental_semeai = EXPERIMENTAL_SEMEAI;
-int semeai_variations   = DEFAULT_SEMEAI_VARIATIONS;
 /* use experimental connection module */
 int experimental_connections = EXPERIMENTAL_CONNECTIONS;
 /* use alternate connection reading algorithm */
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.164
diff -u -p -r1.164 liberty.h
--- engine/liberty.h    22 Apr 2003 02:48:04 -0000      1.164
+++ engine/liberty.h    29 Apr 2003 18:16:33 -0000
@@ -770,6 +770,12 @@ extern int owl_distrust_depth;  /* below
 extern int owl_branch_depth;    /* below this owl tries only one variation */
 extern int owl_reading_depth;   /* owl does not read below this depth */
 extern int owl_node_limit;      /* maximum number of nodes considered */
+extern int semeai_branch_depth;
+extern int semeai_branch_depth2;
+extern int semeai_node_limit;
+extern int connect_depth;
+extern int connect_depth2;
+extern int connection_node_limit;
 extern int level;               /* controls the strength of play */
 extern int semeai_variations;   /* max variations considered reading semeai */
 extern float best_move_values[10];
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.153
diff -u -p -r1.153 owl.c
--- engine/owl.c        28 Apr 2003 23:34:35 -0000      1.153
+++ engine/owl.c        29 Apr 2003 18:16:39 -0000
@@ -57,7 +57,6 @@

 #define MAX_MOVES 3           /* maximum number of branches at each node */
 #define MAX_SEMEAI_MOVES 6    /* semeai branch factor */
-#define SEMEAI_BRANCH_DEPTH 12 /* Only one move considered below this depths.*/
 #define MAX_SEMEAI_DEPTH 100  /* Don't read below this depth */
 #define MAX_LUNCHES 10
 #define MAX_GOAL_WORMS 15  /* maximum number of worms in a dragon to be 
cataloged */
@@ -437,7 +436,7 @@ do_owl_analyze_semeai(int apos, int bpos
   ASSERT1(board[apos] == owla->color, apos);
   ASSERT1(board[bpos] == owlb->color, bpos);

-  if (stackp <= SEMEAI_BRANCH_DEPTH && (hashflags & HASH_SEMEAI)
+  if (stackp <= semeai_branch_depth && (hashflags & HASH_SEMEAI)
       && !pass && owl_phase) {
     if (get_read_result2(SEMEAI, EMPTY, 0, &apos, &bpos, &read_result)) {
       TRACE_CACHED_RESULT2(*read_result);
@@ -769,8 +768,8 @@ do_owl_analyze_semeai(int apos, int bpos
     int mpos = moves[k].pos;

     if (tested_moves > 2
-       || (stackp > 6 && tested_moves > 1)
-       || (stackp > SEMEAI_BRANCH_DEPTH && tested_moves > 0)) {
+       || (stackp > semeai_branch_depth2 && tested_moves > 1)
+       || (stackp > semeai_branch_depth && tested_moves > 0)) {
       /* If allpats, try and pop to get the move in the sgf record. */
       if (allpats && mpos!= NO_MOVE
          && trymove(mpos, color, moves[k].name, apos, komaster, kom_pos)) {
@@ -780,7 +779,7 @@ do_owl_analyze_semeai(int apos, int bpos
       continue;
     }
     if (mpos != NO_MOVE
-       && count_variations < semeai_variations
+       && count_variations < semeai_node_limit
        && stackp < MAX_SEMEAI_DEPTH
        && komaster_trymove(mpos, color, moves[k].name, apos,
                            komaster, kom_pos,
@@ -828,7 +827,7 @@ do_owl_analyze_semeai(int apos, int bpos
          this_resultb = KO_B;
       }

-      if (count_variations >= semeai_variations) {
+      if (count_variations >= semeai_node_limit) {
        TRACE("Out of nodes, claiming win.\n");
        result_certain = 0;
        this_resulta = WIN;
@@ -5187,7 +5186,7 @@ reduced_init_owl(struct local_owl_data *
   if (owl_stack_size == 0) {
     if (experimental_semeai)
       owl_stack_size = gg_max(owl_reading_depth + 2,
-                             2 * SEMEAI_BRANCH_DEPTH + 4);
+                             2 * semeai_branch_depth + 4);
     else
       owl_stack_size = owl_reading_depth + 2;
     owl_stack = malloc(owl_stack_size * sizeof(*owl_stack));
Index: engine/readconnect.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/readconnect.c,v
retrieving revision 1.45
diff -u -p -r1.45 readconnect.c
--- engine/readconnect.c        22 Feb 2003 10:54:24 -0000      1.45
+++ engine/readconnect.c        29 Apr 2003 18:16:43 -0000
@@ -81,9 +81,6 @@ static void order_connection_moves(int *
                                   int color_to_move, const char *funcname);

 static int nodes_connect = 0;
-static int max_nodes_connect = 2000;
-static int max_connect_depth = 64;
-static int max_connect_depth2 = 20; /* Used by the alternate algorithm. */

 /* Used by alternate connections. */
 static char connection_shadow[BOARDMAX];
@@ -1181,12 +1178,12 @@ recursive_connect(int str1, int str2, in
     return WIN;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, 0, "connection node limit reached");
     return 0;
   }

-  if (stackp == max_connect_depth) {
+  if (stackp == connect_depth) {
     SGFTRACE2(PASS_MOVE, 0, "connection depth limit reached");
     return 0;
   }
@@ -1387,12 +1384,12 @@ recursive_disconnect(int str1, int str2,
     return 0;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, WIN, "connection node limit reached");
     return WIN;
   }

-  if (stackp == max_connect_depth) {
+  if (stackp == connect_depth) {
     SGFTRACE2(PASS_MOVE, WIN, "connection depth limit reached");
     return WIN;
   }
@@ -1523,12 +1520,12 @@ recursive_transitivity(int str1, int str
     return WIN;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, 0, "connection node limit reached");
     return 0;
   }

-  if (stackp == max_connect_depth) {
+  if (stackp == connect_depth) {
     SGFTRACE2(PASS_MOVE, 0, "connection depth limit reached");
     return 0;
   }
@@ -1658,12 +1655,12 @@ recursive_non_transitivity(int str1, int
     return 0;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, WIN, "connection node limit reached");
     return WIN;
   }

-  if (stackp == max_connect_depth) {
+  if (stackp == connect_depth) {
     SGFTRACE2(PASS_MOVE, WIN, "connection depth limit reached");
     return WIN;
   }
@@ -1948,12 +1945,12 @@ recursive_connect2(int str1, int str2, i
     return WIN;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, 0, "connection node limit reached");
     return 0;
   }

-  if (stackp > max_connect_depth2) {
+  if (stackp > connect_depth2) {
     SGFTRACE2(PASS_MOVE, 0, "connection depth limit reached");
     return 0;
   }
@@ -2084,12 +2081,12 @@ recursive_disconnect2(int str1, int str2
     return 0;
   }

-  if (nodes_connect > max_nodes_connect) {
+  if (nodes_connect > connection_node_limit) {
     SGFTRACE2(PASS_MOVE, WIN, "connection node limit reached");
     return WIN;
   }

-  if (stackp > max_connect_depth2) {
+  if (stackp > connect_depth2) {
     SGFTRACE2(PASS_MOVE, WIN, "connection depth limit reached");
     return WIN;
   }
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.68
diff -u -p -r1.68 utils.c
--- engine/utils.c      28 Apr 2003 20:45:39 -0000      1.68
+++ engine/utils.c      29 Apr 2003 18:16:43 -0000
@@ -626,6 +626,13 @@ play_connect_n(int color, int do_connect
 #define OWL_DISTRUST_DEPTH    6
 #define OWL_BRANCH_DEPTH      8
 #define OWL_READING_DEPTH    20
+#define SEMEAI_BRANCH_DEPTH  12
+#define SEMEAI_BRANCH_DEPTH2  6
+
+/* Connecton reading */
+#define CONNECT_NODE_LIMIT 2000
+#define CONNECT_DEPTH        64
+#define CONNECT_DEPTH2       20

 /* Set the various reading depth parameters. If mandated_depth_value
  * is not -1 that value is used; otherwise the depth values are
@@ -649,12 +656,14 @@ set_depth_values(int level)
    * genmove.c:     >=  8: call estimate_score().
    * owl.c:         >=  9: use vital attack pattern database
    *                >= 10: increase depth values in owl_substantial
+   *                >= 10: don't turn off owl_phase in semeai reading
    * reading.c:     >= 10: Use superstrings and do more backfilling. (*)
    * value_moves.c: >=  6: try to find more owl attacks/defenses
    *
    * Those two marked (*) are particular expensive. Hence we don't change
    * most depth values between levels 7 and 8 resp. 9 and 10.
-   * FIXME: This isn't correct for owl threats anymore.
+   * FIXME: This isn't correct. Owl threats are turned off anyway, and
+   * superstring doesn't cause a big time difference.
    *
    * depth_level indicates the correction compared to the default settings
    * at level 10 for most reading depths.
@@ -713,6 +722,13 @@ set_depth_values(int level)
     owl_node_limit      = gg_max(20, owl_node_limit);
   }

+  semeai_branch_depth  = gg_max(2, (2*SEMEAI_BRANCH_DEPTH  + depth_level) / 2);
+  semeai_branch_depth2 = gg_max(2, (2*SEMEAI_BRANCH_DEPTH2 + depth_level) / 2);
+  semeai_node_limit    = SEMEAI_NODE_LIMIT * pow(1.5, depth_level);
+
+  connect_depth         = gg_max(2, CONNECT_DEPTH  + 2 * depth_level);
+  connect_depth2        = gg_max(2, CONNECT_DEPTH2 + 2 * depth_level);
+  connection_node_limit = CONNECT_NODE_LIMIT * pow(1.5, depth_level);

   if (mandated_depth != -1)
     depth = mandated_depth;
Index: interface/main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.68
diff -u -p -r1.68 main.c
--- interface/main.c    26 Feb 2003 19:43:51 -0000      1.68
+++ interface/main.c    29 Apr 2003 18:16:45 -0000
@@ -88,7 +88,7 @@ enum {OPT_BOARDSIZE=127,
       OPT_DECIDE_ORACLE,
       OPT_EXPERIMENTAL_SEMEAI,
       OPT_EXPERIMENTAL_OWL_EXT,
-      OPT_SEMEAI_VARIATIONS,
+      OPT_SEMEAI_NODE_LIMIT,
       OPT_EXPERIMENTAL_CONNECTIONS,
       OPT_EXPERIMENTAL_INFLUENCE,
       OPT_ALTERNATE_CONNECTIONS,
@@ -219,7 +219,7 @@ static struct gg_option const long_optio
   {"japanese-rules", no_argument,       0, OPT_JAPANESE_RULES},
   {"experimental-semeai",  no_argument, 0, OPT_EXPERIMENTAL_SEMEAI},
   {"experimental-owl-ext",  no_argument, 0, OPT_EXPERIMENTAL_OWL_EXT},
-  {"semeai-variations",   required_argument, 0, OPT_SEMEAI_VARIATIONS},
+  {"semeai-node-limit",   required_argument, 0, OPT_SEMEAI_NODE_LIMIT},
   {"experimental-connections",  no_argument, 0, OPT_EXPERIMENTAL_CONNECTIONS},
   {"owl-threats",     no_argument,      0, OPT_OWL_THREATS},
   {"no-owl-threats",  no_argument,      0, OPT_NO_OWL_THREATS},
@@ -309,7 +309,6 @@ main(int argc, char *argv[])
   komi = 0.0;

   level = DEFAULT_LEVEL;
-  semeai_variations = DEFAULT_SEMEAI_VARIATIONS;

   mandated_depth               = -1;
   mandated_backfill_depth      = -1;
@@ -453,6 +452,8 @@ main(int argc, char *argv[])
                  "configure option enabled: owl threats\n");
        fprintf(stderr,
                "Owl node limit: %d\n", OWL_NODE_LIMIT);
+       fprintf(stderr,
+               "Semeai node limit: %d\n", SEMEAI_NODE_LIMIT);

        return EXIT_SUCCESS;
        break;
@@ -527,8 +528,8 @@ main(int argc, char *argv[])
        experimental_semeai = 1;
        break;

-      case OPT_SEMEAI_VARIATIONS:
-       semeai_variations = atoi(gg_optarg);
+      case OPT_SEMEAI_NODE_LIMIT:
+       semeai_node_limit = atoi(gg_optarg);
        break;

       case OPT_STANDARD_SEMEAI:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]