Here is what Stockfish does currently when failing high: it immediately stops current iteration, allocates much extra time, moves to next iteration and starts searching it with wider window. (Logic is that we want to be sure that move which failed high, really is as good as it looks like, nothing else matters)bob wrote:There are two cases:
(1) you fail high. There is no need to resolve the fail high, unless a second move fails high. If that happened, we relaxed beta, searched the first move to get a better score, then searched the second move (the second that failed high) again with a null-window search, but now based on the new best score. If it fails low, the first move is best. If it fails high, we do not need to re-search it unless another move fails high. This has a problem. By not re-searching and getting a score, the hash table is not complete with respect to the search of this move, which means the next iteration will start off with missing data, since every other ply won't have a best (PV) move.
Sounds crazy, I know.
Here is choice (d) that Stockfish currently uses:(2) you fail low. Here you have several choices:
(a) re-search immediately to determine how bad the move really is.
(b) just continue searching with original alpha/beta window and hope one of the remaining moves will fall inside and produce a PV. If not, you just wasted a ton of time and still have to go back and re-search the first move again.
(c) start the search over at iteration 1. SInce the best move thru the first N iterations failed low at N+1, that hash entry will continue to make it fail low, and you find a new best move, but you find it iteratively rather than having to start at depth=n with no move ordering info in the hash table. Drawback is that the hash entry for the fail-low can be overwritten. Or other moves look worse at iterations 1-N so that the original best move is still best. And you just wasted a ton of time.
When facing aspiration fail low, it sets flag to not stop search until fail low is resolved (or when really short of time). Then it starts looking for the alternatives for the first move. If it doesn't find one, it moves to next iteration and starts searching it with wider window. (Logic is that because we seem to be in very bad trouble, we should use much extra here and try to see deep enough to find the way out of the trouble [and we do not want to waste valuable time for costly research as in choice (b)]).
Sounds even more crazy, I know. But it works surprisingly often. And when we are facing multiple fail lows in row and can't find a way out, we are very likely losing anyway, no matter what we play. But sometimes this behaviour really sucks and causes score drops from +4 to +1 (luckily this seems to be very rear).