Crazy idea: check the best move that extra ply

Discussion of chess software programming and technical issues.

Moderator: Ras

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Crazy idea: check the best move that extra ply

Post by mcostalba »

At the end of a search on a given position we have our PV line:

1.Bg6+ Kd7 2.e8Q+ Kxd6 3.Be4 Kc5 4.Qe7+ Kb6 5.Qb4+ Ka7 6.Qd4+ b6 7.Qd7+ Kb8 8.Kc3

We are ready to return Bg6 as the best move, but what if over the horizon, let's say at ply 17 there is some hidden threat waiting for us?

We don't have the time to run an extra iteration, but we could run an extra iteration if we start from the middle of the PV line (because it takes much less), so we update our board to:

current position + 1.Bg6+ Kd7 2.e8Q+ Kxd6 3.Be4 Kc5 4.Qe7+ Kb6

and from this position, about half way along the PV line, we run an additional search one ply deeper.

If there is a problem over the horizon we have the change to research otherwise we return our best move that has been checked a bit more deeper.

What is wrong with this scheme ?

Thanks
Marco
User avatar
hgm
Posts: 28359
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Crazy idea: check the best move that extra ply

Post by hgm »

This accomplishes basically the same as late-move reductions.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crazy idea: check the best move that extra ply

Post by bob »

mcostalba wrote:At the end of a search on a given position we have our PV line:

1.Bg6+ Kd7 2.e8Q+ Kxd6 3.Be4 Kc5 4.Qe7+ Kb6 5.Qb4+ Ka7 6.Qd4+ b6 7.Qd7+ Kb8 8.Kc3

We are ready to return Bg6 as the best move, but what if over the horizon, let's say at ply 17 there is some hidden threat waiting for us?

We don't have the time to run an extra iteration, but we could run an extra iteration if we start from the middle of the PV line (because it takes much less), so we update our board to:

current position + 1.Bg6+ Kd7 2.e8Q+ Kxd6 3.Be4 Kc5 4.Qe7+ Kb6

and from this position, about half way along the PV line, we run an additional search one ply deeper.

If there is a problem over the horizon we have the change to research otherwise we return our best move that has been checked a bit more deeper.

What is wrong with this scheme ?

Thanks
Marco
It was done in the Greenblatt program, so it is an old idea. I used it for a while back in the mid-70's in "blitz". But searching just the "pv" one ply deeper doesn't help a lot because now you have a move searched deeper than the rest, and the rest are compared to that move but at a shallower depth.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Crazy idea: check the best move that extra ply

Post by mcostalba »

bob wrote: It was done in the Greenblatt program, so it is an old idea. I used it for a while back in the mid-70's in "blitz". But searching just the "pv" one ply deeper doesn't help a lot because now you have a move searched deeper than the rest, and the rest are compared to that move but at a shallower depth.
In your experience, could have a sense if used just as an alarm to trigger a complete new iteration?

Of course this will bring our search time completely out of previously allocated one, but if we discover that just beyond the horizon the score of our supposed best move drops heavily, perhaps has a sense to do an additional iteration.

Thanks
Marco

P.S: BTW I fail to see the connection between this and LMR. For what I have understood LMR is applied to all nodes, actually more aggressively to non-PV nodes. It is applied from start, not after the last iteration. And is used to prune more then to discover a last minute fail-low just over the horizon.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Crazy idea: check the best move that extra ply

Post by BubbaTough »

The basic idea is not crazy at all. I have tried many variations on this theme. In some versions of my program the idea seems to help a bit, in some it does not. Like almost all ideas in computer chess, it seems very dependent on the individual program.

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

Re: Crazy idea: check the best move that extra ply

Post by bob »

mcostalba wrote:
bob wrote: It was done in the Greenblatt program, so it is an old idea. I used it for a while back in the mid-70's in "blitz". But searching just the "pv" one ply deeper doesn't help a lot because now you have a move searched deeper than the rest, and the rest are compared to that move but at a shallower depth.
In your experience, could have a sense if used just as an alarm to trigger a complete new iteration?

Of course this will bring our search time completely out of previously allocated one, but if we discover that just beyond the horizon the score of our supposed best move drops heavily, perhaps has a sense to do an additional iteration.

Thanks
Marco

P.S: BTW I fail to see the connection between this and LMR. For what I have understood LMR is applied to all nodes, actually more aggressively to non-PV nodes. It is applied from start, not after the last iteration. And is used to prune more then to discover a last minute fail-low just over the horizon.
Here's the idea, in general: At any ply, you have a move list that you can break into groups of moves. Let's call the groups A, B and C in a simple example. Moves in A are somehow tactical in nature, whether they are dangerous for the opponent, or address a threat against us, or even cause a horizon effect in the search. Moves in B are lousy moves that undevelop pieces, retreat pieces, or make pointless piece moves. And moves in C are neither of the above. Today we take moves in A and search them deeper, say in a "check extension" approach.. Moves in B we reduce as in LMR. Moves in C we leave alone and search normally.

You could, instead, reduce B moves heavily, reduce C moves some, and extend A none, and get _exactly_ the same result.

You could, also, Extend A heavily, extend B some, and leave C alone, and also get exactly the same result.

The reported search depths would be significantly different, but the content of the tree would be exactly the same in all three cases.

The challenge becomes figuring out how to accurately categorize moves into A, B or C. The more you put in A, the slower you go. The more you put in C, the more you overlook.

Your approach is more into putting more into A, in what is already a very bushy tree (searching the first branch at the root). The risk is that you spend too much time there, and not enough time elsewhere to find a better move. yes, you sort of "verify the goodness" of the PV move, but you have serious decisions as to how to use the score from the deeper search. If you get a better score, can you trust it, because you started about 1/2 way down the PV and didn't give your opponent any opportunity to change his play to deal with the threat your deeper search discovered. That score might be dangerously optimistic and cause you to make a mistake. if you get a worse score, could you vary your play earlier in the PV to prevent the drop, or it is forced if you play that root move?

So either way, you learned something, but there is not an easy way to use the information to help you play better...
P. Villanueva
Posts: 85
Joined: Sat May 17, 2008 10:57 pm
Location: Bilbao, Spain

Re: Crazy idea: check the best move that extra ply

Post by P. Villanueva »

You can do something like that without running an extra search. Just make your search extensions bigger for PV nodes, or extensions only for PV nodes.
For example, in my engine (still a weak one) the in-check extension is bigger when the check is in a PV node: 1 play normal, 1 play and a half for PV nodes, (i even tried 2 play extensions for PV nodes). This have improved a lot mate finding, so i will use this approach with other extensions, like pawn advances to 7th rank, promotions and others.
That way searches are deeper for PV lines, but only when potentially dangerous moves are played.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Crazy idea: check the best move that extra ply

Post by BubbaTough »

P. Villanueva wrote:You can do something like that without running an extra search. Just make your search extensions bigger for PV nodes, or extensions only for PV nodes.
For example, in my engine (still a weak one) the in-check extension is bigger when the check is in a PV node: 1 play normal, 1 play and a half for PV nodes, (i even tried 2 play extensions for PV nodes). This have improved a lot mate finding, so i will use this approach with other extensions, like pawn advances to 7th rank, promotions and others.
That way searches are deeper for PV lines, but only when potentially dangerous moves are played.
This kind of thing is more the way I do it. Either extending PV or reducing non-PV. Lots of programs do this, they just do it conditionally (like for recaptures or something).

-Sam