Dann vs 1.6.2 quantitative comparison

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Dann vs 1.6.2 quantitative comparison

Post by mcostalba »

Here is the table of measured (not calculated) comparison between 1.6.2 null search depths and Dann's depths based on this algorithm:

Code: Select all

double delta = approximateEval - beta;
delta = Max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int dannR = int(r);

Note that all the depths are given in ply.

Code: Select all


Margin = approximateEval - beta
Depth = depth in ply of current node
Null Std = depth in ply of the resulting null move search for 1.6.2
Null Dann = depth in ply of the resulting null move search for Dann


Margin   Depth  Null Std   Null Dann

300        2        qs       qs
300        3        qs       qs
300        4        qs       qs
300        5        qs       qs
300        6        1        qs
300        7        2        1
300        8        3        1
300        9        4        2
300        10       5        3
300        11       6        3
300        12       7        4
300        13       8        5
300        14       9        5

150        2        qs       qs
150        3        qs       qs
150        4        1        qs
150        5        1        qs
150        6        2        qs
150        7        3        1
150        8        4        2
150        9        5        2
150        10       6        3
150        11       7        3
150        12       8        4
150        13       9        5
150        14      10        5

0          2        qs       qs
0          3        qs       qs
0          4        1        qs
0          5        1        1
0          6        2        1
0          7        3        2
0          8        4        3
0          9        5        3
0          10       6        4
0          11       7        4
0          12       8        5
0          13       9        6
0          14      10        6

-150       2        qs       qs
-150       3        qs       qs
-150       4        1        qs
-150       5        1        1
-150       6        2        1
-150       7        3        2
-150       8        4        3
-150       9        5        3
-150       10       6        4
-150       11       7        4
-150       12       8        5
-150       13       9        6
-150       14      10        6

-300       2        qs       qs
-300       3        qs       qs
-300       4        1        qs
-300       5        1        1
-300       6        2        1
-300       7        3        2
-300       8        4        3
-300       9        5        3
-300       10       6        4
-300       11       7        4
-300       12       8        5
-300       13       9        6
-300       14      10        6


So we can do some consideration:

1) Dann goes in qsearch from null earlier then us. For instance SF goes from null in qsearch at depth 4 ply and below, while Dann goes in qsearch even at depth 5 ply.

2) Dann is much more aggressive in reducing at high depths. Our maximum reduction is 4/5 plies (according to margin to beta), instead Dann keeps reducing, for instance with a margin of 300 above beta at depth 14 null search turns out to be done with a depth of only 5 plies, so that he has reduced of 9 plies !!!

3) Both Dann and 1.6.2 does NOT change a lot with margin to beta, in both cases we are talking of one ply of reduction less going from 300 to -300, not a biggie.


I am not sure point (1) is good, we have made some tests that goes in opposite direction. While we have never tested along the lines of point (2) and I think this will be our next scheduled test ;-)
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Dann vs 1.6.2 quantitative comparison

Post by Daniel Shawul »

The big picture here is that it actually works. Having the lowest branching factor possible has become more important than ever. This may be the time to say goodbye to R = 3. How many times has a reduction/pruning method pronounced unsafe in the past found out it actually helps now? This may be due to a rapidly changing hardware , I don't know, but I know i will never take those kind of things for granted unless I test it myself.

I wrote a code to output the table

Code: Select all

#include <stdio.h>
#include <math.h>

#undef  max
#define max&#40;a, b&#41;          ((&#40;a&#41; > &#40;b&#41;) ? &#40;a&#41; &#58; &#40;b&#41;)
#define OnePly             2
#define PawnMidValue       0x0c6

void main&#40;) &#123;
	int depth,depthp,delta,R1,R2;

	for &#40;delta = 300;delta >= -300;delta -= 150&#41; &#123;
		for&#40;depth = 2;depth <= 64;depth+=2&#41; &#123;

			depthp = depth / OnePly;

			//std
			if&#40;depth >= 5 * OnePly&#41; R1 = 4;
			else R1 = 3;
			if&#40;delta >= PawnMidValue&#41; R1++;

			//dann's
			double ddepth = double&#40;depth&#41;;
			double r = 0.18 * ddepth + 3.1 + log&#40;max&#40;delta,1&#41;)/5.0;
			r = r > ddepth ? ddepth &#58; r;
			R2 = int&#40;r&#41;;

			//format
            char s&#91;256&#93;;
			sprintf&#40;s,"%5d | %3d %3d | %3d %3d |",delta,depth,depthp,R1,R2&#41;;
			if&#40;depthp <= R1&#41; sprintf&#40;s,"%s  qs",s&#41;; else sprintf&#40;s,"%s %3d",s,depthp - R1&#41;;
			if&#40;depthp <= R2&#41; sprintf&#40;s,"%s  qs",s&#41;; else sprintf&#40;s,"%s %3d",s,depthp - R2&#41;;
			sprintf&#40;s,"%s |\n",s&#41;;
			printf&#40;s&#41;;
		&#125;
		printf&#40;"\n");
	&#125;
&#125;
The table has fields : Margin, fractional plies, plies, Rstd, Rdann, Dstd,Ddann.

May be we should use hexadecimal values for Margin as that is what stockfish uses ?

Code: Select all

  300 |   2   1 |   4   2 |  qs  qs |
  300 |   4   2 |   4   4 |  qs  qs |
  300 |   6   3 |   4   5 |  qs  qs |
  300 |   8   4 |   4   5 |  qs  qs |
  300 |  10   5 |   5   6 |  qs  qs |
  300 |  12   6 |   5   6 |   1  qs |
  300 |  14   7 |   5   6 |   2   1 |
  300 |  16   8 |   5   7 |   3   1 |
  300 |  18   9 |   5   7 |   4   2 |
  300 |  20  10 |   5   7 |   5   3 |
  300 |  22  11 |   5   8 |   6   3 |
  300 |  24  12 |   5   8 |   7   4 |
  300 |  26  13 |   5   8 |   8   5 |
  300 |  28  14 |   5   9 |   9   5 |
  300 |  30  15 |   5   9 |  10   6 |
  300 |  32  16 |   5  10 |  11   6 |
  300 |  34  17 |   5  10 |  12   7 |
  300 |  36  18 |   5  10 |  13   8 |
  300 |  38  19 |   5  11 |  14   8 |
  300 |  40  20 |   5  11 |  15   9 |
  300 |  42  21 |   5  11 |  16  10 |
  300 |  44  22 |   5  12 |  17  10 |
  300 |  46  23 |   5  12 |  18  11 |
  300 |  48  24 |   5  12 |  19  12 |
  300 |  50  25 |   5  13 |  20  12 |
  300 |  52  26 |   5  13 |  21  13 |
  300 |  54  27 |   5  13 |  22  14 |
  300 |  56  28 |   5  14 |  23  14 |
  300 |  58  29 |   5  14 |  24  15 |
  300 |  60  30 |   5  15 |  25  15 |
  300 |  62  31 |   5  15 |  26  16 |
  300 |  64  32 |   5  15 |  27  17 |

  150 |   2   1 |   3   2 |  qs  qs |
  150 |   4   2 |   3   4 |  qs  qs |
  150 |   6   3 |   3   5 |  qs  qs |
  150 |   8   4 |   3   5 |   1  qs |
  150 |  10   5 |   4   5 |   1  qs |
  150 |  12   6 |   4   6 |   2  qs |
  150 |  14   7 |   4   6 |   3   1 |
  150 |  16   8 |   4   6 |   4   2 |
  150 |  18   9 |   4   7 |   5   2 |
  150 |  20  10 |   4   7 |   6   3 |
  150 |  22  11 |   4   8 |   7   3 |
  150 |  24  12 |   4   8 |   8   4 |
  150 |  26  13 |   4   8 |   9   5 |
  150 |  28  14 |   4   9 |  10   5 |
  150 |  30  15 |   4   9 |  11   6 |
  150 |  32  16 |   4   9 |  12   7 |
  150 |  34  17 |   4  10 |  13   7 |
  150 |  36  18 |   4  10 |  14   8 |
  150 |  38  19 |   4  10 |  15   9 |
  150 |  40  20 |   4  11 |  16   9 |
  150 |  42  21 |   4  11 |  17  10 |
  150 |  44  22 |   4  12 |  18  10 |
  150 |  46  23 |   4  12 |  19  11 |
  150 |  48  24 |   4  12 |  20  12 |
  150 |  50  25 |   4  13 |  21  12 |
  150 |  52  26 |   4  13 |  22  13 |
  150 |  54  27 |   4  13 |  23  14 |
  150 |  56  28 |   4  14 |  24  14 |
  150 |  58  29 |   4  14 |  25  15 |
  150 |  60  30 |   4  14 |  26  16 |
  150 |  62  31 |   4  15 |  27  16 |
  150 |  64  32 |   4  15 |  28  17 |

    0 |   2   1 |   3   2 |  qs  qs |
    0 |   4   2 |   3   3 |  qs  qs |
    0 |   6   3 |   3   4 |  qs  qs |
    0 |   8   4 |   3   4 |   1  qs |
    0 |  10   5 |   4   4 |   1   1 |
    0 |  12   6 |   4   5 |   2   1 |
    0 |  14   7 |   4   5 |   3   2 |
    0 |  16   8 |   4   5 |   4   3 |
    0 |  18   9 |   4   6 |   5   3 |
    0 |  20  10 |   4   6 |   6   4 |
    0 |  22  11 |   4   7 |   7   4 |
    0 |  24  12 |   4   7 |   8   5 |
    0 |  26  13 |   4   7 |   9   6 |
    0 |  28  14 |   4   8 |  10   6 |
    0 |  30  15 |   4   8 |  11   7 |
    0 |  32  16 |   4   8 |  12   8 |
    0 |  34  17 |   4   9 |  13   8 |
    0 |  36  18 |   4   9 |  14   9 |
    0 |  38  19 |   4   9 |  15  10 |
    0 |  40  20 |   4  10 |  16  10 |
    0 |  42  21 |   4  10 |  17  11 |
    0 |  44  22 |   4  11 |  18  11 |
    0 |  46  23 |   4  11 |  19  12 |
    0 |  48  24 |   4  11 |  20  13 |
    0 |  50  25 |   4  12 |  21  13 |
    0 |  52  26 |   4  12 |  22  14 |
    0 |  54  27 |   4  12 |  23  15 |
    0 |  56  28 |   4  13 |  24  15 |
    0 |  58  29 |   4  13 |  25  16 |
    0 |  60  30 |   4  13 |  26  17 |
    0 |  62  31 |   4  14 |  27  17 |
    0 |  64  32 |   4  14 |  28  18 |

 -150 |   2   1 |   3   2 |  qs  qs |
 -150 |   4   2 |   3   3 |  qs  qs |
 -150 |   6   3 |   3   4 |  qs  qs |
 -150 |   8   4 |   3   4 |   1  qs |
 -150 |  10   5 |   4   4 |   1   1 |
 -150 |  12   6 |   4   5 |   2   1 |
 -150 |  14   7 |   4   5 |   3   2 |
 -150 |  16   8 |   4   5 |   4   3 |
 -150 |  18   9 |   4   6 |   5   3 |
 -150 |  20  10 |   4   6 |   6   4 |
 -150 |  22  11 |   4   7 |   7   4 |
 -150 |  24  12 |   4   7 |   8   5 |
 -150 |  26  13 |   4   7 |   9   6 |
 -150 |  28  14 |   4   8 |  10   6 |
 -150 |  30  15 |   4   8 |  11   7 |
 -150 |  32  16 |   4   8 |  12   8 |
 -150 |  34  17 |   4   9 |  13   8 |
 -150 |  36  18 |   4   9 |  14   9 |
 -150 |  38  19 |   4   9 |  15  10 |
 -150 |  40  20 |   4  10 |  16  10 |
 -150 |  42  21 |   4  10 |  17  11 |
 -150 |  44  22 |   4  11 |  18  11 |
 -150 |  46  23 |   4  11 |  19  12 |
 -150 |  48  24 |   4  11 |  20  13 |
 -150 |  50  25 |   4  12 |  21  13 |
 -150 |  52  26 |   4  12 |  22  14 |
 -150 |  54  27 |   4  12 |  23  15 |
 -150 |  56  28 |   4  13 |  24  15 |
 -150 |  58  29 |   4  13 |  25  16 |
 -150 |  60  30 |   4  13 |  26  17 |
 -150 |  62  31 |   4  14 |  27  17 |
 -150 |  64  32 |   4  14 |  28  18 |

 -300 |   2   1 |   3   2 |  qs  qs |
 -300 |   4   2 |   3   3 |  qs  qs |
 -300 |   6   3 |   3   4 |  qs  qs |
 -300 |   8   4 |   3   4 |   1  qs |
 -300 |  10   5 |   4   4 |   1   1 |
 -300 |  12   6 |   4   5 |   2   1 |
 -300 |  14   7 |   4   5 |   3   2 |
 -300 |  16   8 |   4   5 |   4   3 |
 -300 |  18   9 |   4   6 |   5   3 |
 -300 |  20  10 |   4   6 |   6   4 |
 -300 |  22  11 |   4   7 |   7   4 |
 -300 |  24  12 |   4   7 |   8   5 |
 -300 |  26  13 |   4   7 |   9   6 |
 -300 |  28  14 |   4   8 |  10   6 |
 -300 |  30  15 |   4   8 |  11   7 |
 -300 |  32  16 |   4   8 |  12   8 |
 -300 |  34  17 |   4   9 |  13   8 |
 -300 |  36  18 |   4   9 |  14   9 |
 -300 |  38  19 |   4   9 |  15  10 |
 -300 |  40  20 |   4  10 |  16  10 |
 -300 |  42  21 |   4  10 |  17  11 |
 -300 |  44  22 |   4  11 |  18  11 |
 -300 |  46  23 |   4  11 |  19  12 |
 -300 |  48  24 |   4  11 |  20  13 |
 -300 |  50  25 |   4  12 |  21  13 |
 -300 |  52  26 |   4  12 |  22  14 |
 -300 |  54  27 |   4  12 |  23  15 |
 -300 |  56  28 |   4  13 |  24  15 |
 -300 |  58  29 |   4  13 |  25  16 |
 -300 |  60  30 |   4  13 |  26  17 |
 -300 |  62  31 |   4  14 |  27  17 |
 -300 |  64  32 |   4  14 |  28  18 |

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Dann vs 1.6.2 quantitative comparison

Post by mcostalba »

Daniel Shawul wrote: I wrote a code to output the table
Please Daniel, could you output the depth in plies and not as an integer number ?

I think the fist thing to try to analize it is to use the same notation, otherwise it is easier to misunderstand or get misunderstood.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Dann vs 1.6.2 quantitative comparison

Post by Daniel Shawul »

Hey, I gave both side by side :) Fractional plies and real depth to avoid the confusion. Did I misunderstood you ? Note that your result and mine are identical.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Dann vs 1.6.2 quantitative comparison

Post by mcostalba »

Daniel Shawul wrote:Note that your result and mine are identical.
Yes I know, I also used a little program to print data :-)

My point is that for the reader could not be immediately evident that our numbers are the same because I print depth in plies and you in integer numbers.

Becasue OnePly definition changes among programs I thought was more standard to use notation in ply, so people used to consider depth = 5 equal to depth = 5 plies would get the numbers easier.
Uri Blass
Posts: 10281
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Dann vs 1.6.2 quantitative comparison

Post by Uri Blass »

having the lowest possible branching factor is not a target and it is easy to add counter productive pruning that reduce the branching factor.

I think that the general rule is that adding pruning is good when you have some good extensions.

Crafty is using null move with R=3 everywhere and not R=3/R=2 only because it also added productive extensions of checks in the first ply of the qsearch.

Stockfish now has singular extensions so it may cause some more pruning to be productive for it.

Uri