EBF question

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: EBF question

Post by bob »

Gerd Isenberg wrote:
bob wrote: So, Minmax = W^D terminal nodes.

Alpha/beta = W^floor(D/2) + W^ceil(D/2)

floor = round down to next lower integer, ceil = round up. And for the convenient case of D being even, we get

Alpha/beta = 2 * W ^(D/2)

Now you can plug in some numbers and get an effective branching factor. Say for D=8, and assuming W=38, the number most commonly quoted for average moves in a position, over an entire game,

depth 8 nodes = 2 * (38^4) = 4, 170,272.

Depth 9 nodes = 38^4 + 38^5 = 81,320,304.

The effective branching factor is, for that case, about 20.
...
depth 10 nodes = 2 * (38^5) = 158,470,336
The effective branching factor is, for that case, about 2.

You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
Gerd Isenberg
Posts: 2251
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: EBF question

Post by Gerd Isenberg »

bob wrote:
Gerd Isenberg wrote: You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
What do you mean with expected? Minimal Tree? Didn't alpha-beta minimal tree reduce EBF to sqrt(W) rather than 2 * sqrt(W), i.e. 6 with W = 36?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: EBF question

Post by bob »

Gerd Isenberg wrote:
bob wrote:
Gerd Isenberg wrote: You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
What do you mean with expected? Minimal Tree? Didn't alpha-beta minimal tree reduce EBF to sqrt(W) rather than 2 * sqrt(W), i.e. 6 with W = 36?
I seem to recall really old data (not mine) that reported the time for iteration N+1 averaged about 10x the time for iteration N, overall. With the noted odd/even issues (the reason some did only odd ply searches never made any sense since the even ply searches are way more efficient because of the shape of the tree (the last ply is primarily made up of cut nodes where you just look at one move per node, which is why it is only about 2x larger).

Someone (monty, knuth/moore, I am not sure) mentioned the 2 * sqrt(38) as an approximation. I'll try to give it a little thought and come up with some real math to support what the EBF should be. Pure alpha/beta certainly reduces the tree size from W^D to 2 * W^(D/2) (for D even). I'll have to think about the "sqrt(w)" number you are quoting.
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: EBF question

Post by Zach Wegner »

2 * W^(D/2)
Which corresponds to a branching factor of sqrt(W). (2*sqrt(W)^D)
Dann Corbit
Posts: 12662
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: EBF question

Post by Dann Corbit »

bob wrote:
Gerd Isenberg wrote:
bob wrote:
Gerd Isenberg wrote: You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
What do you mean with expected? Minimal Tree? Didn't alpha-beta minimal tree reduce EBF to sqrt(W) rather than 2 * sqrt(W), i.e. 6 with W = 36?
I seem to recall really old data (not mine) that reported the time for iteration N+1 averaged about 10x the time for iteration N, overall. With the noted odd/even issues (the reason some did only odd ply searches never made any sense since the even ply searches are way more efficient because of the shape of the tree (the last ply is primarily made up of cut nodes where you just look at one move per node, which is why it is only about 2x larger).

Someone (monty, knuth/moore, I am not sure) mentioned the 2 * sqrt(38) as an approximation. I'll try to give it a little thought and come up with some real math to support what the EBF should be. Pure alpha/beta certainly reduces the tree size from W^D to 2 * W^(D/2) (for D even). I'll have to think about the "sqrt(w)" number you are quoting.
Some references on efficiency of alpha-beta:
http://chessprogramming.wikispaces.com/Alpha-Beta

If we have perfect move ordering (which we can only hope to approximate), then alpha beta branching factor is:
b ^ ceil(n/2) + b ^ floor(n/2) - 1

The chess program wiki uses b=40 rather than 38. I have heard 36 and 38 given as approximates for the branching factor. I would guess that it would be hard to get an exact value for pure minimax branching factor because there are so many things that come into play like open or closed openings.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: EBF question

Post by Sven »

Zach Wegner wrote:
2 * W^(D/2)
Which corresponds to a branching factor of sqrt(W). (2*sqrt(W)^D)
The sqrt(W) only applies to the EBF definition proposed by Gerd above (which I support). 2 * W^(D/2) is the optimal node count if D is even, and for that case you have

Code: Select all

EBF(even) = (2 * W^(D/2)) / (W^((D-2)/2) + W^(D/2))
          = (2 * W^(D/2)) / ((1 + W) * W^((D-2)/2))
          = 2 * W / (1+W)
as written above by Gerd.

Sven
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: EBF question

Post by bob »

bob wrote:
Gerd Isenberg wrote:
bob wrote:
Gerd Isenberg wrote: You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
What do you mean with expected? Minimal Tree? Didn't alpha-beta minimal tree reduce EBF to sqrt(W) rather than 2 * sqrt(W), i.e. 6 with W = 36?
I seem to recall really old data (not mine) that reported the time for iteration N+1 averaged about 10x the time for iteration N, overall. With the noted odd/even issues (the reason some did only odd ply searches never made any sense since the even ply searches are way more efficient because of the shape of the tree (the last ply is primarily made up of cut nodes where you just look at one move per node, which is why it is only about 2x larger).

Someone (monty, knuth/moore, I am not sure) mentioned the 2 * sqrt(38) as an approximation. I'll try to give it a little thought and come up with some real math to support what the EBF should be. Pure alpha/beta certainly reduces the tree size from W^D to 2 * W^(D/2) (for D even). I'll have to think about the "sqrt(w)" number you are quoting.
Makes sense this morning. 2* is in numerator and denominator. Thinking late at night after a lengthy call of duty session didn't work very well. :)

That would make the EBF in the 6 range, which seems a bit low. I have a few hardcopy logs from Cray Blitz that I will try to check, as I may well be off in what I remember. That was only 20+ years ago to go back to pre-null-move CB. Our first use of null-move was, I believe, 1989 after don wrote his "selective search without tears" paper which was published in the middle 80's. First challenge is to figure out which version saw first NM implementation, and then to find a printed log in my paper files for some searches for that version...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: EBF question

Post by bob »

bob wrote:
bob wrote:
Gerd Isenberg wrote:
bob wrote:
Gerd Isenberg wrote: You have that individual odd and even EBF.

Isn't it more appropriate if "measuring" average EBF to take the square root from number of nodes n to n+2?

Code: Select all

EBF(odd)  = (W+1)/2
EBF(even) = 2W/(W+1)
EBF(avr)  = sqrt (EBF(odd) * EBF(even) ) = sqrt(W)
I think the number is pretty meaningless since it bounces all over. I seem to recall that Cray Blitz was in the 8-10 range, but it did have null-move, but also SE which hurts EBF...

For approximations, one might sum the odd/even numbers and divide by N, which will take it down to the 10 range Which is in the range of the expected 2 * sqrt(real branching factor).
What do you mean with expected? Minimal Tree? Didn't alpha-beta minimal tree reduce EBF to sqrt(W) rather than 2 * sqrt(W), i.e. 6 with W = 36?
I seem to recall really old data (not mine) that reported the time for iteration N+1 averaged about 10x the time for iteration N, overall. With the noted odd/even issues (the reason some did only odd ply searches never made any sense since the even ply searches are way more efficient because of the shape of the tree (the last ply is primarily made up of cut nodes where you just look at one move per node, which is why it is only about 2x larger).

Someone (monty, knuth/moore, I am not sure) mentioned the 2 * sqrt(38) as an approximation. I'll try to give it a little thought and come up with some real math to support what the EBF should be. Pure alpha/beta certainly reduces the tree size from W^D to 2 * W^(D/2) (for D even). I'll have to think about the "sqrt(w)" number you are quoting.
Makes sense this morning. 2* is in numerator and denominator. Thinking late at night after a lengthy call of duty session didn't work very well. :)

That would make the EBF in the 6 range, which seems a bit low. I have a few hardcopy logs from Cray Blitz that I will try to check, as I may well be off in what I remember. That was only 20+ years ago to go back to pre-null-move CB. Our first use of null-move was, I believe, 1989 after don wrote his "selective search without tears" paper which was published in the middle 80's. First challenge is to figure out which version saw first NM implementation, and then to find a printed log in my paper files for some searches for that version...
easier than I thought. Found some output from 1981 Cray Blitz, searching about 3K nodes per second...

some ebf numbers:

15.75
2.0
7.5
2.7
4.7
5.4
3.5
7.0
4.2

Moving along to 1983 WCCC version on a two CPU Cray XMP:

9.4
2.4
2.5
7.5
4.5
4.7
5.4

And a few numbers from 1983 Belle (no NM there either) as Ken had sent me a log for a game we played that year (this was the 160K nodes per second last edition of Belle)

8.8
5.4
5.1
7.7
6.2
5.8
8.8
5.0
4.6

So ken is right around the sqrt(38) number as well. So not quite as bad as I had remembered.

Was an interesting process to look back at old data, of course...
Gerd Isenberg
Posts: 2251
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: EBF question

Post by Gerd Isenberg »

bob wrote: Makes sense this morning. 2* is in numerator and denominator. Thinking late at night after a lengthy call of duty session didn't work very well. :)

That would make the EBF in the 6 range, which seems a bit low. I have a few hardcopy logs from Cray Blitz that I will try to check, as I may well be off in what I remember. That was only 20+ years ago to go back to pre-null-move CB. Our first use of null-move was, I believe, 1989 after don wrote his "selective search without tears" paper which was published in the middle 80's. First challenge is to figure out which version saw first NM implementation, and then to find a printed log in my paper files for some searches for that version...
Yes, Levin's formula are leaf-nodes(depth) of a minimal alpha-beta tree. Even the aggregated number of nodes of the whole tree and their n versus n-2 ratios quickly converts to the constant branching factor W, 36 here:

Code: Select all

 W  Depth      Leaves       Nodes   Nodes/Nodes-1 Nodes/Nodes-2  SQRT
36      0           1           1         
36      1          36          37      37      
36      2          71         108       2.92       108         10.3923
36      3        1331        1439      13.32        38.8919     6.2363
36      4        2591        4030       2.80        37.3148     6.1086
36      5       47951       51981      12.90        36.1230     6.0102
36      6       93311      145292       2.80        36.0526     6.0044
36      7     1726271     1871563      12.88        36.0048     6.0004
36      8     3359231     5230794       2.79        36.0019     6.0002
36      9    62145791    67376585      12.88        36.0002     6.0000
36     10   120932351   188308936       2.79        36.0001     6.0000
36     11  2237248511  2425557446      12.88        36.0000     6.0000
36     12  4353564671  6779122081       2.79        36.0000     6.0000
Gian-Carlo Pascutto
Posts: 1257
Joined: Sat Dec 13, 2008 7:00 pm

Re: EBF question

Post by Gian-Carlo Pascutto »

bob wrote:Thinking late at night after a lengthy call of duty session didn't work very well. :)
*blink*

Didn't see that one coming.