PV test and PVS

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: PV test and PVS

Post by xr_a_y »

xr_a_y wrote: Sat Jun 09, 2018 6:02 pm :oops: :oops: :oops: TODO: make Weini use int instead of float ... :? :? :?
Done ! :D => in test
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: PV test and PVS

Post by elcabesa »

xr_a_y wrote: Sat Jun 09, 2018 6:02 pm :oops: :oops: :oops: TODO: make Weini use int instead of float ... :? :? :?
in fixed point alphabeta implementation it's really simple to check for beta cutoff

Code: Select all

if( bestScore >= beta)
in floating point the equality test is really difficult because the least significant bits of your number doesn't always have the same precision, but it depend on the magnitude of the number

usually equality (a== b) is calculated as a+d > b > a-d where d is a very small number.
if you want to test that the result of a calculus is equal to 5.0 you have to check that your result is in range 4.999999 and 5.000001because it's probably that (5.0 +10000000.0) -10000000.0 is not really equal to 5.0.

if you want to implement a floating point alpha beta is better you have a really good floating point tricks knownledge, otherwise maybe in some cases your alpha beta search will be suboptimal and you may miss some cutoff or fail-low.
MOBMAT
Posts: 385
Joined: Sat Feb 04, 2017 11:57 pm
Location: USA

Re: PV test and PVS

Post by MOBMAT »

hgm wrote: Sat Jun 09, 2018 4:00 pm Scores above beta when beta != alpha+1 can only occur in a fail-soft framework, though. An even there then will occur only very rarely; as alpha-beta search is based on not wasting time to prove the score is better than you need, it will indeed harly ever do so.
Does the PVS framework change if the engine implements fail-hard?

example code doesn't always explain which framework is being used and I know it has left me scratching my head at time.

I'm using fail-hard since I find it easier to debug. perhaps once I get everything working nicely, I'll switch.
i7-6700K @ 4.00Ghz 32Gb, Win 10 Home, EGTBs on PCI SSD
Benchmark: Stockfish15.1 NNUE x64 bmi2 (nps): 1277K
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: PV test and PVS

Post by elcabesa »

in a fail hard framwork the return value cannot go outside the bonds so the bold characters can be removed i think
if(PVnode)
{
if(moveNumber==1)
{
val = -alphaBeta( -beta, -alpha );
}
else
{
val = -alphaBeta( -alpha-1, -alpha);
if( val > alpha && val < beta )
{
val = -alphaBet( -beta, -alpha );
}
}
}
else
{
val = -alphaBeta( -alpha-1, -alpha );
}