Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: PV length question

Author: Nagendra Singh Tomar

Date: 04:08:33 10/31/02

Go up one level in this thread


On October 31, 2002 at 03:34:51, Severi Salminen wrote:

>>Take the case of the first subtree search at the root, for say the 4th iterated
>>search (with depth 4). The prior depth=3 search would have made one PV. Now as
>>soon as I enter alphabeta, as part of the code I do board->pv_length[ply] = ply,
>>so for ply=0 (root) it become board->pv_length[0] = 0.
>>Now as part of move generation when I am in the GEN_PV phase, how do I know the
>>length of the PV so that I  generate a *correct* PV move.
>>The code goes something like
>>
>>if(board->follow_pv==TRUE && ply<board->pv_length[0])
>>{
>>	generate PV move;
>>
>>}
>>else
>>{
>>either we are not following the PV or the PV was short enough so that it never
>>reached till this ply.
>>}
>>
>>Now if I have already made board->pv_length[0]=0 the second condition in the
>>above if check will always be false.
>
>When you think of it, you'll see where you make an error. You have to understand
>what pv_length[ply]=ply actually means. Maybe you copied it from another program

I think I understand it.

>or some CC document, I don't know: that usually leads to not understanding what
>really happens. (I don't mean to offend, just to remind). PV_Length basically
>tells us how many plies we have PV left for that particular ply. If we have
>pv_length[3]==5, then we have a pv of 2 moves at ply 3. Whether that is part of
>the _actual_ pv (starting from ply 0) is another issue.
>
>When you start a search, you have an actual PV from previous iteration, 3 plies
>for example. So pv_length[0]==3. Now we enter search(depth=4). Why would we need
>to say that pv_length[0]=0??? Well, we don't need to say it at all. It is 3 and
>it can be 3, so pv_length[0]==3.

I am afraid its not like that. "pv_length[ply]=ply" clause is there because, if
the current node contrbutes to the PV length, it will be only of length 'ply',
this will increase if this node gets a PV from some child node (which is done
inside UPDATE_PV). So IOW pv_length[ply]=ply has got significance ONLY for leaf
nodes. For other nodes anyway it gets ovwewritten inside UPDATE_PV as soon as we
get a child with score>alpha. So if we have a way of knowing that a node is a
leaf node then we can do "pv_length[ply]=ply"  only for child nodes. For other
nodes it will be copied from the child having score>alpha.
So in a depth=4 search (after doing depth=1,2,3 searches) the moment we enter
the root node (ply==0) we do 'pv_length[ply]=ply' pv_length[0] becomes 0.
I hope I am clear this time !!


>We just continue our search and the above
>condition works. And if and when we get another PV (most likely 4 plies deep),
>then the pv_length[0] gets updated. So remove the pv_length[0]=0 statement.
>Actually you should consider writing a separate rootsearch() function to take
>care everything that is done only in root - that way you don't have to make any
>exceptions if you use something like pv_length[ply]=ply in search().
>
>>One way I can think of is to use the hash as the PV will be there in the hash
>
>Yes, that is another issue. PV can be retrieved from hash table (unless part of
>it has been rewritten there). I have not yet done that so I can't help more. But
>just by following HT moves from root position you should be able to retrieve the
>whole PV. Worth trying!
>
>Severi

regds
tomar



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.