That seems wrong to me. Why? Why not prune bad moves? Because you want more accuracy in the PV? That makes no sense to me because what if the SECOND move you search is really the best? You prune it more heavily? So that it can't become the PV move?Don wrote:The general answer is that the PV node is handled much more conservatively with respect to pruning and reductions. And you can be a bit more aggressive with respect to extensions in the PV nodes too.bob wrote:Nothing out of the way with what you wrote. The issue is "What do you do or not do at a PV "node". The root position is ALWAYS a PV node. If you treat it as such, that could mean that at THAT node, you do everything the same way. Which means treating all moves equally. But after making the first move at the root, and going to another PV node, when you come back to the root and try a different move, you end up at a non-PV node unless move ordering is broken.Don wrote:The root position is a pv node. A node is a position of course, not a move.bob wrote: The issue seemed to revolve around the definition of "PV node". For example, after making the first move, we reach ply=2. One way of looking at this is that this position is a PV node and NOTHING unusual happens to ANY move here. That seems wrong. The other way, not the way I was initially thinking, was that just the move itself that is searched with an open window is not reduced, or not reduced as much.
So I suppose the definition of "PV node" might need a slight modification. In normal discussion, a PV node, as defined in Knuth/Moore (An analysis of alpha/beta pruning) was a node on the left-hand-side of the graph, one PV node per ply, so the "left-most" nodes. I "think", however, that we are talking about "pv moves" instead, which is a different thing.
Do you disagree with any of that? And do you agree that we "seem" to be talking about PV moves rather than the classic PV nodes? Because I certainly reduce lots of moves at PV nodes. Such as doing LMR at the root, which was better in my testing...
I don't think the last chapter of what to do on a fail low or a fail high has been written. And I am almost certain that they should not be treated exactly the same way, even though this is exactly what I do at the present...
From any pv node the first move played takes us to another pv node. The second move searched and beyond do not lead to pv nodes. If they are done in the PVS framework where you search them with a zero width window then if one of those nodes fails high, it is searched again AS a pv node, i.e. the move is treated as if it's the first move leading to a new PV node.
Another way to look at this is that all pv nodes have some alpha and beta window, but the zero width window searches are always "scout" searches, designed to always fail. A scout search is never a pv node of course.
For clarity it is useful to have 2 searches. One is searchPV and the other is searchNonPV. searchNonPV could be called searchNullWindow if you wanted. SearchPv often calls searchNonPV but searchNonPV never calls searchPV.
I am not sure that conforms to Knuth/Moore without looking at it again. If you assume a perfectly ordered tree it would be always be the left-node or the first move played, but in practice a non-pv sometimes has to be "promoted" to a pv node which means it "should have" been the first move searched.
The confusion arises when you mix up the term "move" with "node" and this gave Larry a lot of trouble when we talked about it and I was trying to get him to understand. If you have 36 moves that can be played from a PV node Larry made the mistake of thinking of them as "pv moves" because they were searched inside the PV search. But except for 1 (or any that got promoted) they were mostly moves that led to non-pv nodes.
In a program such as yours which does not explicitly make the distinction, it's difficult to identify whether a given node is a pv node or not. If you use PVS search you could say that if the window is zero width it's probably not a pv node but I think it could still be a pv node in some circumstances although I believe that is a very temporary situation.
The issue is, then, are we talking about treating NODES differently (PV vs ALL/CUT) or are we talking about treating MOVES differently? That is where the confusion seems to come in.
What you describe (search PV vs search non-PV) is not about nodes. It is about moves. Because you are treating moves at a PV node differently depending on whether they are searched first, or later.
In Crafty, I treat everything equally, with the only exception being that I don't do null-move at a PV "node", because (a) it can't fail high and (b) I can't allow the result to become the "best move/score" here since a null-move is illegal. But everything else that I do is done uniformly across all moves...
I don't think in ANY search you can accurately say "this is a PV node or this is not." Because we don't have perfect move ordering, and non-PV nodes morph into PV nodes occasionally, when move ordering is wrong. And, of course, PV nodes become non-PV nodes for the same reason.
In PV nodes we do not do null move, futility pruning or any of those sorts of things.
This all seems to be theoretically unsound. If pruning is unsafe anywhere, it must be unsafe everywhere, so why do it?
If this idea works, it works for the wrong reason. There MUST be a way to prune correctly so that not pruning on PV nodes is not a stopgap measure that works due to poor pruning decisions...
That was my point in the initial discussion about treating PV vs non-PV moves/nodes differently.
I might not prune unless I am within N plies of a leaf, but I believe that I should prune ANYWHERE that meets my pruning criteria. Otherwise I am wasting even more time on the PV because my pruning avoids (theoretically, anyway) expending effort that is wasted...
I don't even remotely agree with that. If that is the case, why not just search the first move and quit and move on to the next iteration? If you search the rest of the moves, you must expect one of them to become the new PV on occasion. How can they if you whack the trees apart with aggressive pruning? That's a point I simply don't get...
In some sense the conceptual model is that the PV search is the "real" search and the only one that matters.
Not really. If you avoid pruning on the first move, how much of the tree do you get rid of? That tree becomes 90% of the total effort and you can't reduce that further without resorting to more pruning. Hence my disagreement with not pruning on PV nodes. that's the biggest part of the tree, and the part where the most savings are possible.That makes it ridiculously selective. Everything else can be viewed as black box to determine if a move should be included in this highly selective PV search. In other words, think of everything else as a candidate move generator for a highly selective program. To be a candidate move generator one would expect it to "throw out" moves faster than they would normally be searched and so the non-pv search does this by means of using null move pruning, futility pruning, highly aggressive LMR, and some surprisingly aggressive forward pruning. It does not select moves, it only decides whether a move is worthy of being included in the "real" search.
This also explains why the branching factor of modern chess programs is 2 or even less.
[quote\ We are essentially just doing a PV search where we are looking (usually) at just 1 or 2 moves and throwing out everything else.
If you think of the non-pv nodes as part of the "real" search you are missing the point. Of course it's semantics, but I see these nodes as simply part of an elaborate recursive candidate move generator in a highly selective search.[/quote]
How do they promote to "needs to be searched further"? That is the problem...
