Is LMR Sound.

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Is LMR Sound.

Post by bob »

hgm wrote:
Henk wrote:The program can use the null move for detecting threats, that's something I understand. I read the earlier posts and I do not understand the interference of null moves and LMR. To keep it simple: if search depth is reduced by LMR you should decrease R of the null move ?
Most engines actually increase it. And this makes sense: you want to reduce the null move more than the real moves, so if almost all real moves are already reduced, you must reduce the null move more to keep up with it.
I didn't quite follow what he was asking. Null-move is reduced, obviously, as that is a part of the concept. LMR doesn't apply to null move in any way, however, so I don't understand what he was asking. LMR applies only to real moves...
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Is LMR Sound.

Post by lucasart »

Henk wrote:Tried LMR for the tenth time. Used a simple implementation: apply LMR when move is not a capturing move. Did not notice much improvement.
Maybe the program is more tactical, but I also saw very bad strategical lines.For instance bishop got locked in totally by its own pawns.

I cannot measure ELO. But if there is any improvement it certainly is not spectacular. I remove the LMR from the program. I don't want extra code in my program if it doesn't help much.
I think you should read this thread carefully, all your questions are answered in it
http://www.talkchess.com/forum/viewtopi ... at&start=0

And please do your homework before spamming again to say that LMR doesn't work because you played one game and got a bishop trapped... You CAN measure ELO, but you are too lazy to do it, that's all. Download and compile cutechess-cli, and learn how to use it, and do not spam until you have done your homework and have some testing results to show.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

It was about the question:
"
Almost every chess program uses null move checks or reductions which take a lot of cpu time. Is it safe to apply LMR within these null moves checks or will the variant be reduced too much."

So is there something you can do with LMR if alfa = beta or
alfa = beta -1 (when lowerbound and upperbound have identical or almost identical values). "
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Is LMR Sound.

Post by Chan Rasjid »

Henk wrote:It was about the question:
"
Almost every chess program uses null move checks or reductions which take a lot of cpu time. Is it safe to apply LMR within these null moves checks or will the variant be reduced too much."

So is there something you can do with LMR if alfa = beta or
alfa = beta -1 (when lowerbound and upperbound have identical or almost identical values). "
Too much of a good thing can turn sick.

The beauty I see is that I don't understand a thing about what you are talking about and which you seem to know pretty well. :D

btw, LMR never work!
You have been lied to!
You are sharp as a ball.

Rasjid.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Is LMR Sound.

Post by hgm »

Henk wrote:So is there something you can do with LMR if alfa = beta or
alfa = beta -1 (when lowerbound and upperbound have identical or almost identical values). "
Note that alpha = beta is a non-sensical situation, which can never occur if you did properly take the beta cutoffs in earlier nodes. You only narrow the search window by increasing alpha, and in a node where you would increase alpha to beta you would take a beta cutoff, so no moves would be searched with the thus increased alpha.

In PVS you search all moves other than the first with beta = alpha+1. Only the first move uses the original beta, which in almost all nodes (namely the non-PV nodes) also happens to be equal to alpha+1 (because some parent set it so). That includes all moves that suffer LMR.

Now it is a matter of taste how you treat a fail-hi of such a move. You can first do a re-search with open window, to verify the fail-hi persists, and only if it does, remove the reduction as well. Or first remove the reduction, but keep the null window, and only open the window for another re-search if that one fails hi as well. There even are engines that do upto 3 re-searches (first open window, reduced, then null-window unreduced, and finally open-window, reduced). What works best depends on how stable your search is.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Is LMR Sound.

Post by lucasart »

Henk wrote:It was about the question:
"
Almost every chess program uses null move checks or reductions which take a lot of cpu time. Is it safe to apply LMR within these null moves checks or will the variant be reduced too much."

So is there something you can do with LMR if alfa = beta or
alfa = beta -1 (when lowerbound and upperbound have identical or almost identical values). "
None of that makes any sense:
- you need to understand the basics of alpha beta: if you ever have alpha=beta, there's something very wrong with what you're doing. the phrase "identical or almost identical" really confirms that you don't understand anything. so please start from the basics and do not try to lecture a field of experts with your newbie misconceptions about LMR.
- null move takes a lot of CPU time? again you really don't understand anything, and you haven't done your homework on null move either. so please do not write more nonsense like that. null move saves you a lot of CPU time because it allows you to search much fewer nodes to reach the same depth, with a rather negligible cost (relatively minor inaccuracies by null move)
- ok so what do you propose? if you do a null move at a given node, then the whole subtree below that null move will be treated specially and will not have LMR applied into it? I haven't even tested it, because I'm 100% sure it's a stupid idea and will not work. but feel free to try.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

My question was about PVS.But it is about the situation that the select is called select (depth - reduction, -value, -value) where value element of [lb, ub]

Within this select the method has no (easy) access to the parameters of the original bigger interval [lb .. ub] doing a research is not that easy.

So within select(-value, -value) or select (-value-1, -value) no reduction can be applied ?!

In null move reduction you get a similar situation
score = -Select(depth - 3(00), -ub, -ub) with value = ub
within this select I should undo this reduction adding up 3(00) again ??!
I certainly should not perform another LMR reduction and decrease this depth - 3(00) with another -1(00).


( by he way lb = alfa; ub = beta)


I hope this reply and other questions doesn't make it more and more unclear. Maybe I better stop (at least for a while)
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

Ok i'll read the thread. sorry, sorry, sorry.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Is LMR Sound.

Post by Don »

You don't manipulate the margins at all, only the depth.

I'll assume your program does not use the PVS framework but does use negamax, do you follow that?

When you get to the moves you want to reduce, you simple do:

Code: Select all

      // reduce
      score =  -search(  -(alpha+1),  -alpha,  depth - 2, .... );

      if (score > alpha) { 
         score = -search(  -beta, -alpha,  depth - 1, .... );
      }
Note that you use the same alpha in both searches (the second argument in the negamax swap) but for the reduced search you DON'T CARE about the score other than to know if it's greater than alpha.

Also, note that depth-1 is what you always do when moving to the next node down the tree so the second search in my example is the normal one. But the first search I reduce by an extra ply.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
Henk
Posts: 7220
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

I must prevent the null move from using R=4 instead of 3 effectively. I can not check easily if alfa beta is called when doing a null move reduction or not. Of course, I can use another parameter for that, cluttering all my select (alfa beta methods) methods or another global variable (even worse). So I do not use LMR just for clarity.

I got the same problem when checking history ( checking whether three times same position gives a draw). That also was damaging clarity of my code.