[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] engine/influence.c
From: |
Arend Bayer |
Subject: |
Re: [gnugo-devel] engine/influence.c |
Date: |
Mon, 23 Sep 2002 15:39:21 +0200 (CEST) |
On Sat, 21 Sep 2002, Gunnar Farneback wrote:
> Today we could probably try a more aggressive cutoff.
> I reviewed the patterns using the xterri and oterri helpers and I'm
> fairly certain these could equally well be replaced by checking
> whether the territorial value is larger than 0.95 or something like
> that.
>
> The only potential problem I can see is what happens at vertices where
> both colors have small influence and an early cutoff would cause only
> one of them down to zero. This may or may not be a problem.
The territory valuation should be robust against this (due to the
min_inf_for_territory policy). I have sligthly revised whose_territory()
and whose_moyo_restricted() to take this into account. I get three FAILs
(I am comparing CVS+loop bug fixed with CVS+loop bug fixed+aggressive
cutoff). Overall I think it is OK:
nngs2:
10 unexpected FAIL: Correct '!H6', got 'H6'
H6 is bad yes, but H7 (played by CVS) is even worse.
nngs3:15:
400 unexpected FAIL: Correct 'N13', got 'Q15'
This is caused by a change in the valuation by 0.02, i.e. accidental.
safety.tst:
1 unexpected FAIL: Correct 'R6|S2', got 'O14'
For this we can indeed make the change responsible. O14 is a bit
overvalued, partly due to a higher follow-up value. I think the current
code is overvalueing potential center territory a bit, and this should
be fixed, but preferably in a separate patch.
Runing safety.tst, I now get:
time seconds seconds calls ms/call ms/call name
7.76 5.23 5.23 12578 0.42 0.45 compute_primary_domains
6.51 9.62 4.39 3496496 0.00 0.00 scan_for_patterns
5.06 13.03 3.41 23255 0.15 0.15 accumulate_influence
I.e. a considerable speed improvement. Maybe one could make the cutoff
level dependent.
Arend
Patch is on top of unrolling_3_9.1a.
diff -u engine/influence.c engine/influence.c
--- engine/influence.c 20 Sep 2002 21:17:56 -0000
+++ engine/influence.c 23 Sep 2002 13:10:26 -0000
@@ -129,13 +129,8 @@
int a = (arg_di)*(i-m) + (arg_dj)*(j-n); \
contribution *= (a*a) * b; /* contribution *= cos(phi) */ \
} \
- if (contribution <= INFLUENCE_CUTOFF) { \
- if (permeability < 1.0 || q->w[arg_i][arg_j] != 0.0) \
- continue; \
- else { \
- contribution = 1.01 * INFLUENCE_CUTOFF; \
- } \
- } \
+ if (contribution <= INFLUENCE_CUTOFF) \
+ continue; \
if (q->w[arg_i][arg_j] == 0.0) { \
q->queuei[queue_end] = (arg_i); \
q->queuej[queue_end] = (arg_j); \
@@ -1096,8 +1091,7 @@
accumulate_influence(q, i, j, BLACK);
}
- if (q->is_territorial_influence)
- value_territory(q, m, n, color);
+ value_territory(q, m, n, color);
segment_influence(q);
if (((q == &initial_influence || q == &initial_opposite_influence)
@@ -1123,13 +1117,14 @@
{
float bi = q->black_influence[m][n];
float wi = q->white_influence[m][n];
+ float terr = q->territory_value[m][n];
ASSERT_ON_BOARD2(m, n);
- if (bi > 0.0 && wi == 0.0)
+ if (bi > 0.0 && wi == 0.0 && terr < -0.95)
return BLACK;
- if (wi > 0.0 && bi == 0.0)
+ if (wi > 0.0 && bi == 0.0 && terr > 0.95)
return WHITE;
return EMPTY;
@@ -1184,9 +1179,9 @@
/* default */
if (territory_color != EMPTY)
color = territory_color;
- else if ((bi > 10.0 * wi && bi > 10.0 && wi < 10.0) || bi > 25.0 * wi)
+ 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) || wi > 25.0 * bi)
+ else if (wi > 10.0 * bi && wi > 10.0 && bi < 10.0)
color = WHITE;
else
color = EMPTY;
- Re: [gnugo-devel] engine/influence.c (and DFA), (continued)
- Re: [gnugo-devel] engine/influence.c (and DFA), bump, 2002/09/06
- Re: [gnugo-devel] engine/influence.c (and DFA), Dave Denholm, 2002/09/06
- Re: [gnugo-devel] engine/influence.c (and DFA), bump, 2002/09/06
- Re: [gnugo-devel] engine/influence.c (and DFA), Dave Denholm, 2002/09/06
- Re: [gnugo-devel] engine/influence.c (and DFA), bump, 2002/09/06
- Re: [gnugo-devel] engine/influence.c (and DFA), Arend Bayer, 2002/09/12
- Re: [gnugo-devel] engine/influence.c (and DFA), Dave Denholm, 2002/09/12
- Re: [gnugo-devel] engine/influence.c (and DFA), Arend Bayer, 2002/09/12
- Re: [gnugo-devel] engine/influence.c, Arend Bayer, 2002/09/20
- Re: [gnugo-devel] engine/influence.c, Gunnar Farneback, 2002/09/21
- Re: [gnugo-devel] engine/influence.c,
Arend Bayer <=
- Re: [gnugo-devel] engine/influence.c, Arend Bayer, 2002/09/24
- Re: [gnugo-devel] engine/influence.c, Dave Denholm, 2002/09/23
- Re: [gnugo-devel] engine/influence.c, Arend Bayer, 2002/09/23