gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] tactical move ordering tuning


From: Evan Berggren Daniel
Subject: [gnugo-devel] tactical move ordering tuning
Date: Mon, 18 Nov 2002 13:09:26 -0500 (EST)

This patch tweaks the move ordering in reading.c in order to do a better
job of trying successful moves first.

Reading node reductions:

reading.tst from 106624 to 93970 (11% reduction)
owl.tst from 31198038 to 30678644 (1.7% reduction)

I tuned it against reading.tst because that was fast to run, but more
performance gains can probably be achieved with the selection of a better
benchmark.

This gets a FAIL in owl:170.  I believe this is because attack() returns a
different move, with the same code, that is then used as a vital owl
attack, and is less successful in that role.  I believe this should be
counted as purely accidental.

However, I think it means it might be worth while to write a function that
gives an array of all attack moves (and a corresponding defense function)
with the same highest code, and use all such attack moves in owl_attack.

I have not run other benchmarks or a full regression suite.

Thanks

Evan Daniel

- tune tactical move ordering

Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.84
diff -u -r1.84 reading.c
--- engine/reading.c    12 Nov 2002 16:34:05 -0000      1.84
+++ engine/reading.c    18 Nov 2002 14:03:21 -0000
@@ -52,8 +52,7 @@
     int u;\
     for (u = 0; u < (moves).num; u++)\
       if ((moves).pos[u] == (move)) {\
-        if ((moves).score[u] < this_score)\
-          (moves).score[u] = this_score;\
+       (moves).score[u] += this_score;\
        break;\
       }\
     if ((u == (moves).num) && ((moves).num < MAX_MOVES)) {\
@@ -4395,7 +4394,7 @@

   for (r = 0; r < adj; r++) {
     findlib(adjs[r], 1, &xpos);
-    ADD_CANDIDATE_MOVE(xpos, 0, *moves);
+    ADD_CANDIDATE_MOVE(xpos, 1, *moves);
   }
 }

@@ -4495,10 +4494,10 @@
     return;

   if (is_edge_vertex(libs[0]) && !is_self_atari(libs[1], color))
-    ADD_CANDIDATE_MOVE(libs[1], 0, *moves);
+    ADD_CANDIDATE_MOVE(libs[1], 1, *moves);

   if (is_edge_vertex(libs[1]) && !is_self_atari(libs[0], color))
-    ADD_CANDIDATE_MOVE(libs[0], 0, *moves);
+    ADD_CANDIDATE_MOVE(libs[0], 1, *moves);
 }

 /*
@@ -4824,7 +4823,7 @@
          * is safe for the defender.
         */
        if (!is_self_atari(libs[k], board[str]))
-         ADD_CANDIDATE_MOVE(libs[k], 0, *moves);
+         ADD_CANDIDATE_MOVE(libs[k], 1, *moves);
       }
     }
   }
@@ -5103,22 +5102,22 @@
  */

 /*                                              0   1   2   3   4  >4  */
-static int defend_lib_score[6]              = {-5, -4,  0,  2,  5, 20};
-static int defend_not_adjacent_lib_score[5] = { 0,  0,  2,  4,  6};
+static int defend_lib_score[6]              = {-5, -4,  0,  3,  5, 50};
+static int defend_not_adjacent_lib_score[5] = { 0,  0,  2,  3,  5};
 static int defend_capture_score[6]          = { 0,  6,  9, 13, 18, 24};
-static int defend_atari_score[6]            = { 0,  2,  4,  6,  8, 10};
+static int defend_atari_score[6]            = { 0,  2,  4,  6,  7, 8};
 static int defend_save_score[6]             = { 0,  3,  6,  8, 10, 12};
 static int defend_open_score[5]             = { 0,  1,  2,  3,  4};
 static int attack_own_lib_score[5]          = {10, -4,  2,  3,  4};
-static int attack_string_lib_score[6]       = {-5,  1,  3,  7, 12, 20};
+static int attack_string_lib_score[6]       = {-5,  2,  3,  7, 10, 19};
 static int attack_capture_score[6]          = {-4,  4, 10, 15, 20, 25};
-static int attack_save_score[6]             = { 0, 11, 15, 18, 21, 24};
-static int attack_open_score[5]             = { 0,  1,  2,  3,  4};
+static int attack_save_score[6]             = { 0, 10, 13, 18, 21, 24};
+static int attack_open_score[5]             = { 0,  0,  2,  4,  4};
 static int defend_not_edge_score            = 5;
 static int attack_not_edge_score            = 1;
 static int attack_ko_score                  = -15;
 static int cannot_defend_penalty            = -20;
-static int safe_atari_score                 = 5;
+static int safe_atari_score                 = 8;


 /* The string at (str) is under attack. The moves.num moves in





reply via email to

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