Node counting in iterative deepening

Discussion of chess software programming and technical issues.

Moderator: Ras

Sazgr
Posts: 66
Joined: Thu Dec 09, 2021 8:26 pm
Full name: Kyle Zhang

Node counting in iterative deepening

Post by Sazgr »

Hi all,

I started working on a chess engine recently and have been looking at CPW, this forum etc.
I was wondering in iterative deepening whether the node count and time outputted by engines are only for one iteration or in total
To give an example, suppose my engine searched 20 nodes in the first depth 1 search and another 67 in depth 2, would it output something like

Code: Select all

info depth 1 nodes 20 ...
info depth 2 nodes 87 ...
or

Code: Select all

info depth 1 nodes 20 ...
info depth 2 nodes 67 ...
This may be a stupid question :oops: but I would appreciate if anyone helps
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Node counting in iterative deepening

Post by hgm »

Usually engines report the total of all iterations.
AndrewGrant
Posts: 1957
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: Node counting in iterative deepening

Post by AndrewGrant »

Report total nodes searched. If you want the information about "how many were searched this ply", that can be derived from the existing information. Also, anything other than "total nodes" becomes incoherent once you start talking about SMP.
User avatar
algerbrex
Posts: 608
Joined: Sun May 30, 2021 5:03 am
Location: United States
Full name: Christian Dean

Re: Node counting in iterative deepening

Post by algerbrex »

Interesting, I assumed nodes were usually reported per ply. Not sure why.
Sazgr
Posts: 66
Joined: Thu Dec 09, 2021 8:26 pm
Full name: Kyle Zhang

Re: Node counting in iterative deepening

Post by Sazgr »

Since I output the total number of nodes, would the branching factor of that ply be 67/20 = 3.35 or 87/20 = 4.35?
JVMerlino
Posts: 1397
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Node counting in iterative deepening

Post by JVMerlino »

Sazgr wrote: Sat Jul 16, 2022 7:55 pm Since I output the total number of nodes, would the branching factor of that ply be 67/20 = 3.35 or 87/20 = 4.35?
You would use 67/20 in this case, but usually I find it's easier to do ("time-to-depth for ply N+1" / "time-to-depth for ply N"). Just beware that branching factor can vary wildly between ply if you experience one or more fail-highs or fail-lows at or near the root.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Node counting in iterative deepening

Post by hgm »

Sazgr wrote: Sat Jul 16, 2022 7:55 pm Since I output the total number of nodes, would the branching factor of that ply be 67/20 = 3.35 or 87/20 = 4.35?
Yes, that is true. But there will only be a significant difference in the first few ply. For deeper ply both the the quantities you divide on each other will be 'contaminated' with all the smaller depths. So in a sense you will be measuring some average of all the EBF so far, where the lower depths have a much smaller weight.
Sazgr
Posts: 66
Joined: Thu Dec 09, 2021 8:26 pm
Full name: Kyle Zhang

Re: Node counting in iterative deepening

Post by Sazgr »

Thanks everyone!