Question Regarding PV-Collection

Discussion of chess software programming and technical issues.

Moderator: Ras

StackFish5
Posts: 18
Joined: Fri Dec 24, 2021 5:48 pm
Full name: Andrew Zhuo

Question Regarding PV-Collection

Post by StackFish5 »

Currently in my chess engine, I use a pv-collection system:

Code: Select all

MOVE pv_line[MAX_PLY];
...

//PV Collection in alpha-beta
if(score > alpha){
	alpha = score;
	pv_line[current_ply] = move;
}
However, I'm wondering whether about the benefits triangular pv-tables are worth it as it seems that many people use it. To me, it appears to be overly redundant and slow, especially the part were the pv move is copied to all other occurrences applicable. Are there any benefits to using triangular pv-tables?
abulmo2
Posts: 466
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Question Regarding PV-Collection

Post by abulmo2 »

The triangular PV gives a correct PV, your PV collection system returns a random sequence of moves, but not the PV.
Richard Delorme
User avatar
AAce3
Posts: 80
Joined: Fri Jul 29, 2022 1:30 am
Full name: Aaron Li

Re: Question Regarding PV-Collection

Post by AAce3 »

StackFish5 wrote: Sun Oct 09, 2022 11:09 pm Currently in my chess engine, I use a pv-collection system:

Code: Select all

MOVE pv_line[MAX_PLY];
...

//PV Collection in alpha-beta
if(score > alpha){
	alpha = score;
	pv_line[current_ply] = move;
}
However, I'm wondering whether about the benefits triangular pv-tables are worth it as it seems that many people use it. To me, it appears to be overly redundant and slow, especially the part were the pv move is copied to all other occurrences applicable. Are there any benefits to using triangular pv-tables?
This doesn't look correct.
If you have a tree, the first best move will be correct. The second best move will be whatever raises alpha in some other branch, and the third move will be some other move that raises in some other branch, etc. etc. Basically, you have no way of ensuring that the pv moves are all from the same branch of the tree.
User avatar
flok
Posts: 558
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Question Regarding PV-Collection

Post by flok »

StackFish5 wrote: Sun Oct 09, 2022 11:09 pm Currently in my chess engine, I use a pv-collection system:
Just curious: but why not just walk the TT?
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Question Regarding PV-Collection

Post by hgm »

flok wrote: Mon Oct 10, 2022 8:47 am
StackFish5 wrote: Sun Oct 09, 2022 11:09 pm Currently in my chess engine, I use a pv-collection system:
Just curious: but why not just walk the TT?
Because the TT often gets overwritten. Joker retrieved the PV from the TT after the search, but often the PV ended in a position that did not have the same evaluation as the move that was played. (Which was especially obvious when checkmates were involved.)