gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Another cosmic patch


From: Stéphane Nicolet
Subject: [gnugo-devel] Another cosmic patch
Date: Fri, 18 Jul 2003 01:42:41 +0200


Here is another version of the cosmic patch.

Its effects can be roughly separated in two parts :

1) in influence.c : changing the curves for the
   center/edges influence repartition.  The separation
   is now less abrupt  between the edge and the center,
   so that the  patched version likes to make territory
   on the edge too and will not *always* try to make a
   moyo in the center. I have also smoothed the differences
   between odd/even moves, to lower down the pair-go effect.

2) in gnugo.h, globals.c, value_moves.c : introduction of
   six  global variables to make experiments by changing
   the weights of
      territorial effects,
      strategical effects,
      maximum_value and minimum_values (from the joseki database)
      invasions
      attack_dragon

   As you can see in the patch, setting the six weights to
   1.0 doesn't change anything wrt current CVS. The weights
   I have set for the cosmic evaluation are intended to
   give somewhat more weight to the territorial effects,
   and less to the joseki values, for instance.



Part (1) alone gives an engine that wins 56% as White
against 3.3.22 (in a 250 games match, komi 6.5, W won 140 :
games in http://cassio.free.fr/go/)


Parts (1)+(2) is clearly better than part (1) alone in
the small tests I have done (it currently leads 8-2 as
White in a 3 stones match against 3.2).


Stéphane

=============================================================




diff -b -B -p -u ./gnugo-3.3.23-cvs/engine/globals.c ./gnugo-3.3.23/engine/globals.c
--- ./gnugo-3.3.23-cvs/engine/globals.c Tue Jul  8 21:39:21 2003
+++ ./gnugo-3.3.23/engine/globals.c     Fri Jul 18 00:20:38 2003
@@ -194,3 +194,25 @@ double slowest_time = 0.0;
 int    slowest_move = NO_MOVE;
 int    slowest_movenum = 0;
 double total_time = 0.0;
+
+
+#if COSMIC_GNUGO
+
+float minimum_value_weight = 0.66;
+float maximum_value_weight = 2.0;
+float territorial_weight   = 1.35;
+float strategical_weight   = 0.5;
+float invasion_weight      = 1.6;
+float attack_dragon_weigth = 0.62;
+
+#else
+
+float minimum_value_weight = 1.0;
+float maximum_value_weight = 1.0;
+float invasion_weight      = 1.0;
+float territorial_weight   = 1.0;
+float strategical_weight   = 1.0;
+float attack_dragon_weigth = 1.0;
+
+#endif
+
diff -b -B -p -u ./gnugo-3.3.23-cvs/engine/gnugo.h ./gnugo-3.3.23/engine/gnugo.h
--- ./gnugo-3.3.23-cvs/engine/gnugo.h   Fri Jun 20 14:56:23 2003
+++ ./gnugo-3.3.23/engine/gnugo.h       Thu Jul 17 01:59:21 2003
@@ -318,6 +318,20 @@ extern int limit_search;  /* limit move
extern int oracle_exists; /* oracle is available for consultation */ extern int metamachine; /* use metamachine_genmove */

+
+
+/* ================================================================ */
+/*           global variables we want to fit (must be float)        */
+/* ================================================================ */
+
+extern float minimum_value_weight;
+extern float maximum_value_weight;
+extern float invasion_weight;
+extern float strategical_weight;
+extern float territorial_weight;
+extern float attack_dragon_weigth;
+
+
 /* ================================================================ */
 /*                 tracing and debugging functions                  */
 /* ================================================================ */
diff -b -B -p -u ./gnugo-3.3.23-cvs/engine/influence.c ./gnugo-3.3.23/engine/influence.c
--- ./gnugo-3.3.23-cvs/engine/influence.c       Mon Jul 14 18:22:18 2003
+++ ./gnugo-3.3.23/engine/influence.c   Thu Jul 17 02:31:52 2003
@@ -68,8 +68,9 @@ static struct influence_data *current_in

 #if COSMIC_GNUGO

-/* Threholds values used in the whose_moyo() function */
+/* Threholds values used in the whose_moyo() functions */
 struct moyo_determination_data moyo_data;
+struct moyo_determination_data moyo_restricted_data;

 /* Threholds value used in the whose_territory() function */
 float territory_determination_value;
@@ -391,15 +392,23 @@ init_influence(struct influence_data *q,
    */
     if ((board_size != 19) || (movenum <= 2) || ((movenum / 2) % 2)   )
       cosmic_importance = 0.0;
-    else {
-      cosmic_importance = 1.0 - (movenum / 120.0)*(movenum / 120.0);
+    else
+       {
+      cosmic_importance = 1.0 - (movenum / 150.0)*(movenum / 150.0);
       cosmic_importance = gg_max(0.0, cosmic_importance);
     }

     t = cosmic_importance;
-    moyo_data.influence_balance     = t * 5.0  +  (1.0-t) * 7.0;
+
+    moyo_data.influence_balance     = t * 15.0  +  (1.0-t) * 5.0;
     moyo_data.my_influence_minimum  = t * 5.0  +  (1.0-t) * 5.0;
-    moyo_data.opp_influence_maximum = t * 20.0 +  (1.0-t) * 10.0;
+    moyo_data.opp_influence_maximum = t * 30.0  +  (1.0-t) * 30.0;
+
+    /* we use the same values for moyo and moyo_restricted */
+ moyo_restricted_data.influence_balance = moyo_data.influence_balance; + moyo_restricted_data.my_influence_minimum = moyo_data.my_influence_minimum; + moyo_restricted_data.opp_influence_maximum = moyo_data.opp_influence_maximum;
+

     territory_determination_value   = t * 0.95 +  (1.0-t) * 0.95;

@@ -407,13 +416,13 @@ init_influence(struct influence_data *q,
      * { 6,  0.0, 24.0, { 6.0, 15.0, 26.0, 36.0, 45.0, 50.0, 55.0 }};
      */

-    min_infl_for_territory.values[0] = t * 20.0  +  (1.0-t) *  6.0;
-    min_infl_for_territory.values[1] = t * 20.0  +  (1.0-t) * 15.0;
-    min_infl_for_territory.values[2] = t * 20.0  +  (1.0-t) * 26.0;
-    min_infl_for_territory.values[3] = t * 25.0  +  (1.0-t) * 36.0;
-    min_infl_for_territory.values[4] = t * 25.0  +  (1.0-t) * 45.0;
-    min_infl_for_territory.values[5] = t * 25.0  +  (1.0-t) * 50.0;
-    min_infl_for_territory.values[6] = t * 25.0  +  (1.0-t) * 55.0;
+    min_infl_for_territory.values[0] = t * 6.0   +  (1.0-t) * 10.0;
+    min_infl_for_territory.values[1] = t * 10.0  +  (1.0-t) * 15.0;
+    min_infl_for_territory.values[2] = t * 20.0  +  (1.0-t) * 15.0;
+    min_infl_for_territory.values[3] = t * 20.0  +  (1.0-t) * 20.0;
+    min_infl_for_territory.values[4] = t * 20.0  +  (1.0-t) * 20.0;
+    min_infl_for_territory.values[5] = t * 15.0  +  (1.0-t) * 15.0;
+    min_infl_for_territory.values[6] = t * 10.0  +  (1.0-t) * 15.0;

 #endif

@@ -1268,10 +1277,28 @@ whose_moyo_restricted(const struct influ
   /* default */
   if (territory_color != EMPTY)
     color = territory_color;
+
+#if COSMIC_GNUGO
+
+  else if (bi > moyo_restricted_data.influence_balance * wi &&
+           bi > moyo_restricted_data.my_influence_minimum   &&
+           wi < moyo_restricted_data.opp_influence_maximum)
+    color = BLACK;
+  else if (wi > moyo_restricted_data.influence_balance * bi &&
+           wi > moyo_restricted_data.my_influence_minimum   &&
+           bi < moyo_restricted_data.opp_influence_maximum)
+    color = WHITE;
+
+#else
+
+
   else if (bi > 10.0 * wi && bi > 10.0 && wi < 10.0)
     color = BLACK;
   else if (wi > 10.0 * bi && wi > 10.0 && bi < 10.0)
     color = WHITE;
+
+#endif
+
   else
     color = EMPTY;

diff -b -B -p -u ./gnugo-3.3.23-cvs/engine/value_moves.c ./gnugo-3.3.23/engine/value_moves.c
--- ./gnugo-3.3.23-cvs/engine/value_moves.c     Sun Jun 22 15:59:37 2003
+++ ./gnugo-3.3.23/engine/value_moves.c Thu Jul 17 01:56:35 2003
@@ -2384,6 +2384,9 @@ estimate_strategical_value(int pos, int
          }
        }
                
+ /* SN : we multiply by attack_dragon_weigth to try to find a best fit (3.3.23) */
+       this_value = this_value * attack_dragon_weigth;
+               
        if (this_value > dragon_value[aa]) {
          dragon_value[aa] = this_value;
           DEBUG(DEBUG_MOVE_REASONS,
@@ -2495,6 +2498,8 @@ estimate_strategical_value(int pos, int

   /* Finally, subtract penalty for invasion type moves. */
   this_value = strategic_penalty(pos, color);
+ /* SN : multiply by invasion_weight to allow us to fit the weight (3.3.23) */
+  this_value = this_value * invasion_weight;
   if (this_value > 0.0) {
     TRACE("  %1m: %f - strategic penalty, considered as invasion.\n",
          pos, -this_value);
@@ -2568,7 +2573,10 @@ value_move_reasons(int pos, int color, f
     estimate_strategical_value(pos, color, score);
   }

- tot_value = move[pos].territorial_value + move[pos].strategical_value;
+  /* SN : introduction of strategical_weight and territorial_weight,
+     for automatic fitting (3.3.23) */
+  tot_value = territorial_weight * move[pos].territorial_value +
+              strategical_weight * move[pos].strategical_value;

   shape_factor = compute_shape_factor(pos);

@@ -2729,6 +2737,10 @@ value_move_reasons(int pos, int color, f
       tot_value = new_tot_value;
     }
   }
+
+ /* SN : min_value is now subject to reduction with a fitted weight (3.3.23) */
+  move[pos].min_value = move[pos].min_value * minimum_value_weight;
+  move[pos].max_value = move[pos].max_value * maximum_value_weight;

   /* Test if min_value or max_value values constrain the total value.
    * First avoid contradictions between min_value and max_value,





reply via email to

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