futility pruining, razoring question

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Rebel
Posts: 6997
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: futility pruining, razoring question

Post by Rebel »

diep wrote: Oh by the way the 10 pawn window for alpha was used by Ed, i'd be very careful razoring on alpha indeed as you correctly warn,
yet i would start testing the above and do without qsearch first.

Only after that test WITH qsearch. It's trivial to test all combinations there though i'd say...

In Diep razoring doesn't work at all.
You are correct, I threw out the type of razoring you talk about eventually.

But keep in mind the "razoring" you and me refer to is something else what is understood by others. Perhaps someone is willing to explain it one more time.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: futility pruining, razoring question

Post by diep »

Rebel wrote:
diep wrote: Oh by the way the 10 pawn window for alpha was used by Ed, i'd be very careful razoring on alpha indeed as you correctly warn,
yet i would start testing the above and do without qsearch first.

Only after that test WITH qsearch. It's trivial to test all combinations there though i'd say...

In Diep razoring doesn't work at all.
You are correct, I threw out the type of razoring you talk about eventually.

But keep in mind the "razoring" you and me refer to is something else what is understood by others. Perhaps someone is willing to explain it one more time.
Ed ,this Rybka & clones are razoring last 3.5 plies (last 7 units) at beta with 1.5 pawns. So a discussion about razoring here is pretty much on topic, not some 'blast from the past'.

The first one to report to me razoring worked for his engine this century, that was Omid David Tabibi. With Falcon he already got 18-20 ply around start 2001-2003 or so in this manner. So the was a prelude of what was to come...
Not sure where he has gone now - last time i spoke to him he was busy testlaunching some new missiles...
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: futility pruining, razoring question

Post by JVMerlino »

lucasart wrote:

Code: Select all

	if &#40;UseRazoring && depth <= RazorDepth
		&& !is_pv && !is_mate_score&#40;beta&#41; && !in_check&#41;
	&#123;
		if &#40;current_eval + RazorMargin&#40;depth&#41; <= alpha&#41; &#123;
			const int score = qsearch&#40;B, alpha, beta, 0, ply+1, is_pv, si+1&#41;;
			if &#40;score + RazorMargin&#40;depth&#41; <= alpha&#41;	//**
				return score;
		&#125;
	&#125;
My version is a little different than the above, and I wonder now if it is wrong/dangerous:

Code: Select all

	int nMargin&#91;4&#93; = &#123; 0, 75, 150, 275 &#125;;
	
	if (!bInCheck && !bNullMove && !bPVNode && &#40;nDepth < 4&#41;)
	&#123;
		int nEval = Evaluate&#40;-INFINITY, INFINITY&#41;;
		
		if &#40;nEval < nAlpha - nMargin&#91;nDepth&#93;)
			return&#40;Quiesce&#40;nAlpha, nBeta, pvLine&#41;);

		if &#40;nEval > nBeta + nMargin&#91;nDepth&#93;)
			return nBeta;
	&#125;
I'm concerned about the fact that my code doesn't recheck against (Alpha - nMargin) after doing the qsearch -- it simply returns the qsearch eval. Is this bad?

jm
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: futility pruining, razoring question

Post by diep »

Yes it should be bad Jim.

Why not try:

Code: Select all

if (&#40;nScore=Quiesce&#40;nAlpha, nBeta, pvLine&#41; < nAlpha - nMargin&#91;nDepth&#93;)
			return nScore;

Note i didn't figure out how this works out at depth 0 for you.

Also maybe add to the margin pvnode*128 and drop the pvnode condition for the betapruning.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: futility pruining, razoring question

Post by JVMerlino »

diep wrote:Yes it should be bad Jim.

Why not try:

Code: Select all

if (&#40;nScore=Quiesce&#40;nAlpha, nBeta, pvLine&#41; < nAlpha - nMargin&#91;nDepth&#93;)
			return nScore;

Note i didn't figure out how this works out at depth 0 for you.

Also maybe add to the margin pvnode*128 and drop the pvnode condition for the betapruning.
I don't do this at depth 0 because the code to drop to qsearch normally is right before this code.

Ok. I'll give this other version a try.

Thanks, Vincent!

jm
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: futility pruining, razoring question

Post by lucasart »

diep wrote: beta razoring:

Code: Select all

if&#40; depthleft <= 3 && eval >= beta + 1.5 pawn ) return eval;
So for "beta razoring" (I call it eval pruning and marco calls it static null move pruning) you suggest 1.5 pawns, independant of depth ? This is folly...
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: futility pruining, razoring question

Post by diep »

lucasart wrote:
diep wrote: beta razoring:

Code: Select all

if&#40; depthleft <= 3 && eval >= beta + 1.5 pawn ) return eval;
So for "beta razoring" (I call it eval pruning and marco calls it static null move pruning) you suggest 1.5 pawns, independant of depth ? This is folly...
I have a book from start 80s somewhere where this is called razoring, so let's keep calling it like that :)

It's trivial to experiment with all sorts of things here, provided that razoring works at all for you. If the above doesn't work i would be careful putting much time into it :)
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: futility pruining, razoring question

Post by ZirconiumX »

FruitFly uses the Strelka style of razoring, which gave a decent speedup at the time.

Now I was going to print the with and without figures, but it actually seems to be faster without it. :?

This may have something to do with the fact I also razor above beta (Stockfish idea), as well as below it.

Scratching head, Matthew:out
Some believe in the almighty dollar.

I believe in the almighty printf statement.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: futility pruining, razoring question

Post by elcabesa »

I'm reading again and again the whole post nad I'm rather confuse. :-)

let's see if I could summarize everything I have read about Razoring

just after Qsearch (if depth<=0) and TT testing i could try to razor the search.

There is Razoring (cutting if score <alpha) and static null move pruning or eval pruning (score>beta)

talking about Razoring

Code: Select all

if&#40;!isCheck && beta ==alpha+1 && depth<=3 && abs&#40;beta&#41; < CHECKMATESCORE - 1000&#41;&#123;

	int score=board.eval&#40;);

        if ( score - razoringMargin&#40;depth&#41; < alpha )
        &#123;

            int res = qsearch&#40; ply, alpha-razoringMargin&#40;depth&#41;, beta - razoringMargin&#40;depth&#41; );
           if &#40;res - razoringMargin&#40;depth&#41; <= alpha&#41;   
             return score; 
        &#125;
    &#125;
&#125;

what still I havent' understood is how big could be razorMargin.


talking instead about Static Null Move Pruning, it could be done even in no PV nodes, and could be done without Qsearch and with a smaller margin.
something like this:

Code: Select all

if&#40;!isCheck && depth<=3 && abs&#40;beta&#41; < CHECKMATESCORE - 1000&#41;&#123;
int score=board.eval&#40;);

  if ( score + margin&#91;depth&#93; > beta )&#123;
    return beta;
  &#125;

&#125;
I hope I haven't done too much errors :)
Have I understood it correctly?
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: futility pruining, razoring question

Post by elcabesa »

I have found an error,

Code: Select all

if ( score   > beta + margin&#91;depth&#93;)
        &#123;
			return beta;

        &#125;