Page 1 of 2

Extensions in the days of LMR?

Posted: Tue Mar 22, 2016 7:09 pm
by fierz
Dear all,

I recently integrated LMR (or some variant of it) into my engine, with good results. My code looks like this

Code: Select all

LMR = 0; 
		if (i > LMR_N &&								// only try late moves i> 4
			iscapture[realdepth - 1] == 0 &&		// don't try on captures
			depth > LMR_MINDEPTH  &&					// only if some depth is remaining
			ischeck[realdepth - 1] == 0	&&			// not if we are moving out of a check
			ispawnpush[realdepth -1] == 0	&&		// not for passed pawn pushes 
			ispv == 0								// not for the pv
			
			// TODO: promotions have to be exempt! but this is such a rare occasion that it shouldn't matter
			) {
			// LMR candidate - check if we are in check
			if (p->sidetomove == WHITE && !(isattacked(p, p->wking, BLACK)))
				LMR = LMR_REDUCE;
			if (p->sidetomove == BLACK && !(isattacked(p, p->bking, WHITE)))
				LMR = LMR_REDUCE;
Now I wonder: since reductions are sort of inverted extensions, and LMR reduces all kinds of moves but not checks, and not captures, and not pawn pushes, do I still need these check/recapture/pawnpush extensions or not? Do you still have them?

cheers
Martin

Re: Extensions in the days of LMR?

Posted: Tue Mar 22, 2016 9:44 pm
by bob
fierz wrote:Dear all,

I recently integrated LMR (or some variant of it) into my engine, with good results. My code looks like this

Code: Select all

LMR = 0; 
		if (i > LMR_N &&								// only try late moves i> 4
			iscapture[realdepth - 1] == 0 &&		// don't try on captures
			depth > LMR_MINDEPTH  &&					// only if some depth is remaining
			ischeck[realdepth - 1] == 0	&&			// not if we are moving out of a check
			ispawnpush[realdepth -1] == 0	&&		// not for passed pawn pushes 
			ispv == 0								// not for the pv
			
			// TODO: promotions have to be exempt! but this is such a rare occasion that it shouldn't matter
			) {
			// LMR candidate - check if we are in check
			if (p->sidetomove == WHITE && !(isattacked(p, p->wking, BLACK)))
				LMR = LMR_REDUCE;
			if (p->sidetomove == BLACK && !(isattacked(p, p->bking, WHITE)))
				LMR = LMR_REDUCE;
Now I wonder: since reductions are sort of inverted extensions, and LMR reduces all kinds of moves but not checks, and not captures, and not pawn pushes, do I still need these check/recapture/pawnpush extensions or not? Do you still have them?

cheers
Martin
I removed everything but check extensions a couple of years back. Was an Elo gain to do so. Removing check extension hurt, however... Although I found another Elo gain by not extending checks that SEE says loses material...

Re: Extensions in the days of LMR?

Posted: Tue Mar 22, 2016 10:09 pm
by hgm
Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?

Re: Extensions in the days of LMR?

Posted: Tue Mar 22, 2016 10:30 pm
by jdart
hgm wrote:Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?
I assume you mean, reduce losing checks? That sounds like a reasonable idea but most engines don't do that. (Mine doesn't either although it is a little hard to see why in the code .. I only reduce moves that are in the "history phase" of move generation, and check evasions have no such phase). Last I tried it was not an improvement.

--Jon

Re: Extensions in the days of LMR?

Posted: Tue Mar 22, 2016 10:46 pm
by hgm
Well, you would only know they are losing after you searched them. So what I mean is reducing all checks (possibly by 0 ply), and then re-search them with an extension if they score above alpha. Just as with any LMR'ed move. Another way to describe this as applying normal LMR after you have given the extension.

Re: Extensions in the days of LMR?

Posted: Wed Mar 23, 2016 12:04 am
by bob
hgm wrote:Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?
I tried several combinations recently.

(1) no check extensions. -10 Elo in Crafty

(2) extend checks with SEE >= 0, 0 (normal)

(3) LMR unsafe checks (SEE < 0) -10 Elo

That's not to say there is not some middle ground. IE LMR still applied to SEE < 0 checks, just a smaller reduction. That's not yet been tried.

Re: Extensions in the days of LMR?

Posted: Wed Mar 23, 2016 12:06 am
by bob
hgm wrote:Well, you would only know they are losing after you searched them. So what I mean is reducing all checks (possibly by 0 ply), and then re-search them with an extension if they score above alpha. Just as with any LMR'ed move. Another way to describe this as applying normal LMR after you have given the extension.
Sounds worth testing, but not something I have done...

Re: Extensions in the days of LMR?

Posted: Thu Mar 24, 2016 12:51 pm
by fierz
bob wrote: I removed everything but check extensions a couple of years back. Was an Elo gain to do so. Removing check extension hurt, however... Although I found another Elo gain by not extending checks that SEE says loses material...
Thanks for sharing. It seems to have done my engine a world of good :-)

cheers
Martin

Re: Extensions in the days of LMR?

Posted: Thu Mar 24, 2016 5:06 pm
by Robert Pope
How big is your LMR_REDUCE? I am only using one for now. I've tried 4-5 variations of LMR and they always perform significantly worse (60-80 ELO) than my baseline without LMR.

Re: Extensions in the days of LMR?

Posted: Thu Mar 24, 2016 5:17 pm
by fierz
Dear Robert,

my LMR_REDUCE is 1 ply and it works very very well!

cheers
Martin