LMP in PV nodes

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: LMP in PV nodes

Post by cdani »

Bloodbane wrote:This might be a stupid question, but how could LMP even be theoretically correct at PV-nodes? The point of LMP is to reduce the time spent at ALL-nodes, and PV-nodes are not ALL-nodes so I do not see how there would be any sense in applying it there. Or is it the fact that a PV-node can turn into an ALL-node in some cases?
I think is more a matter of time gained than other things.
xmas79
Posts: 286
Joined: Mon Jun 03, 2013 7:05 pm
Location: Italy

Re: LMP in PV nodes

Post by xmas79 »

Bloodbane wrote:This might be a stupid question, but how could LMP even be theoretically correct at PV-nodes? The point of LMP is to reduce the time spent at ALL-nodes, and PV-nodes are not ALL-nodes so I do not see how there would be any sense in applying it there. Or is it the fact that a PV-node can turn into an ALL-node in some cases?
But PV nodes are also ALL-nodes, except that you have found an exact score... You keep searching late moves because you hope to find a better move, but theorically you are already done... That's the whole idea of LMR & co. I suppose... and once you have found an exact score you could skip all the remaining moves if you are too greedy and want to settle with that score. Of course you do not want to prune THAT much...

People, correct me if I'm wrong...
petero2
Posts: 688
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: LMP in PV nodes

Post by petero2 »

Bloodbane wrote:This might be a stupid question, but how could LMP even be theoretically correct at PV-nodes? The point of LMP is to reduce the time spent at ALL-nodes, and PV-nodes are not ALL-nodes so I do not see how there would be any sense in applying it there. Or is it the fact that a PV-node can turn into an ALL-node in some cases?
I think the idea behind LMP is that if your move ordering is good enough, there is a high probability that the best move is searched early. Therefore there is often no point in searching the late moves, and thus the time saved by skipping them could be worth more than the cost of the introduced inaccuracies.

This reasoning would apply also to PV nodes.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: LMP in PV nodes

Post by jdart »

I have never done LMP at PV nodes - I agree it is probably unsound.

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

Re: LMP in PV nodes

Post by bob »

jdart wrote:I have never done LMP at PV nodes - I agree it is probably unsound.

--Jon
I keep hearing this, but I don't understand the reasoning behind it. How, exactly, is a PV node different from a non-PV node? Don't you expect that on occasion, a non-PV node will actually fail high and become a PV node? I don't see how late moves at a non-PV node are any different from late moves anywhere in the tree, from a theoretical perspective...
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: LMP in PV nodes

Post by jdart »

Well, the root node is a PV node. And you wouldn't want to do LMP there. Most of the time it would work but there would be cases where you'd not get the best move from the search, maybe not ever.

The purpose of a PV node is to get a best move and a score for that move.

The purpose of a non-PV node is to have reasonable confidence that you can't do better than the current best variation (the PV). So IMO it makes sense to reserve LMP for the non-PV nodes.

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

Re: LMP in PV nodes

Post by bob »

jdart wrote:Well, the root node is a PV node. And you wouldn't want to do LMP there. Most of the time it would work but there would be cases where you'd not get the best move from the search, maybe not ever.

The purpose of a PV node is to get a best move and a score for that move.

The purpose of a non-PV node is to have reasonable confidence that you can't do better than the current best variation (the PV). So IMO it makes sense to reserve LMP for the non-PV nodes.

--Jon
Why would it not work at the root, assuming you do it at positions with such a great remaining depth.

Your "purpose" statement seems confused. The first move you search is NOT necessarily "the best move". Therefore you are likely doing LMP on actual best moves as well as on non-best-moves. It simply seems unsound to me. If it works, it should work everywhere since we do not have perfect move ordering. If it doesn't work everywhere, then it seems perfectly rational to think it is not good anywhere.

The basic idea is that you give up hope on finding something better as you search more and more moves at any position. That idea seems perfectly reasonable since the error can be measured and evaluated against the speed gain. If the speed gain more than offsets the occasional error, it's a good idea, otherwise is bad.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: LMP in PV nodes

Post by jdart »

Suppose the best move is a sacrifice, and you take the reasonable move ordering approach of trying losing captures last.

Then, with LMP in the root node (we are talking about pruning here, not reductions), you will never play the sacrifice, no matter what depth you achieve. It will keep getting pruned, every time.

--Jon
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: LMP in PV nodes

Post by Sven »

jdart wrote:Suppose the best move is a sacrifice, and you take the reasonable move ordering approach of trying losing captures last.

Then, with LMP in the root node (we are talking about pruning here, not reductions), you will never play the sacrifice, no matter what depth you achieve. It will keep getting pruned, every time.

--Jon
Apart from the first few iterations (current SF: 15) you will automatically avoid LMP in the root node since LMP is usually applied at shallow depths only. Furthermore another typical LMP condition is that the move is not a capture. For these two reasons your example of a sacrifice getting pruned every time would be restricted to "quiet sacrifices" (probably not what you meant) within the first few iterations only. I think this does not justify to say that handling PV nodes differently for LMP were necessary due to problems at the root node.

Whether excluding PV nodes from LMP is theoretically sound or not is not easy to answer in my opinion, I would always vote for "it depends on testing with the actual engine".
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMP in PV nodes

Post by bob »

jdart wrote:Suppose the best move is a sacrifice, and you take the reasonable move ordering approach of trying losing captures last.

Then, with LMP in the root node (we are talking about pruning here, not reductions), you will never play the sacrifice, no matter what depth you achieve. It will keep getting pruned, every time.

--Jon
OK, suppose the 15th move in the root list is a capture that loses. Do you reduce it or not? What about the 15th move at ply=2 positions?

This STILL makes absolutely no sense to me. If it is OK to reduce moves that you HOPE will become a new best move, then it should be just as OK to reduce moves that are already part of a best move.