Collecting PV in a PVS search ?

Discussion of chess software programming and technical issues.

Moderator: Ras

MahmoudUthman
Posts: 237
Joined: Sat Jan 17, 2015 11:54 pm

Re: Collecting PV in a PVS search ?

Post by MahmoudUthman »

hgm wrote:You do not collect the PV in the usual way in the root at the time a new PV move is found. Instead you do it at the end of the iteration, where you combine the best move with the PV left on the PV stack, which must have been put there by the latest PV daughter.

But it is not guaranteed that this PV daughter will also be the one responsible for the best move. In the face of search instability a NonPV pilot search can fail high, trigger a PV re-search, which then fails low after all. But it would produce a PV, overwriting the PV of the earlier best-move daughter.

A PV node that fails high can return an empty PV, if alpha was not increased before the cutoff occurs.
Thank you , one last thing why does SF update PV in fail high

Code: Select all

if (value > alpha)
				{
					if (PvNode) // Update pv even in fail-high case
						update_pv(ss->pv, move, (ss + 1)->pv);

					if (PvNode && value < beta) // Update alpha here!
					{
						alpha = value;
						bestMove = move;
					}
					else // Fail high
					{
						tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER,
							ttDepth, move, ss->staticEval, TT.generation());

						return value;
					}
				}
User avatar
hgm
Posts: 28475
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Collecting PV in a PVS search ?

Post by hgm »

It seems pointless, as a fail high would mean the move in the parent node fails low, and would (even in Stockfish) not do anything with the PV of its daughter. So you would just be updating a PV that is going to be discarded.

Perhaps it is for the benefit of the root, so that it can print a one-move PV on a fail high against the aspiration window. Stockfish used to print inconsistent PVs for fail highs and lows in the root; I don't know if this is still the case. Logically a fail high in the root should produce a one-move PV, a fail low no PV at all.