Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Break from aspiration window loop when Signals.stop is true only after outputting pv info dump #20

Open
wants to merge 2 commits into from

3 participants

@tpsinnem

[Edited in a new lead paragraph because otherwise it was confusing]

Hello!

I noticed that the final iteration of the aspiration window loop produces no uci pv output. I made this change in case there is not some existing reason why that information should not be posted.

I noticed this thing when experimenting with nodes limits -- from reading the code, I got the impression that node limits would usually be exceeded, and only then would the search stop and the final info be reported. However in the stockfish uci output the nodes count was (nearly) always under the limit.

I did note, afterwards, that the Search Log does get the final info but it would be nice to have it in the uci dump as well, if there's no obstacle.

Cheers!

@tpsinnem

Also, I suppose my above comment may give the impression that the nodes limit being exceeded was a problem, but for me at least it isn't, at least in the single-threaded case. Just a side note :)

@mcostalba
Owner
@tpsinnem

Thanks for the response!

Is it not the case, though, that the move decision (i.e. 'bestmove' output) is made based on the same info that uci_pv would have in the final AW loop iteration, if it was called? It would seem to me that cases with Signals.stop (whether from the outside, or via node limits etc.) are imperfect whichever way you go; in the unpatched stockfish, I can get cases like this (this is from a chess960 position btw, though I don't think it matters), where the bestmove and the first reported pv move don't agree:

info depth 11 seldepth 3 score cp 32 nodes 3993 nps 137689 time 29 multipv 1 pv e4e2 g7f7 c4d5 e6d5 a3c3 d8c8 b4d3 f6f3 e2f3 f7f3 e1e7 c7d6
stop
bestmove c4d5 ponder e6d5

I would think this is a problem?

@tpsinnem

That, btw was of course an example where I triggered Signals.stop myself, but this move report disagreement also happens with time or node limit checks being triggered, and I think that's worse, since in the case with the user interaction, it's at least clear that the search was indeed interrupted, which would hopefully make the discrepancy less alarming to the user.

@tpsinnem

On a completely different note, I had made edits to the original message because I realized it was unclear, and I'm guessing that a) Github doesn't send those edits as follow-ups through the any e-mail interface and that b) you are responding through such an e-mail interface. If it's no trouble, I hope my intent is more clear if you'll read it on Github! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 4, 2012
  1. @tpsinnem
  2. @tpsinnem

    removed worry comment

    tpsinnem authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/search.cpp
View
10 src/search.cpp
@@ -416,17 +416,17 @@ namespace {
for (size_t i = 0; i <= PVIdx; i++)
RootMoves[i].insert_pv_in_tt(pos);
+ // Send full PV info to GUI if we are going to leave the loop or
+ // if we have a fail high/low and we are deep in the search.
+ if ((bestValue > alpha && bestValue < beta) || SearchTime.elapsed() > 2000)
+ cout << uci_pv(pos, depth, alpha, beta) << endl;
+
// If search has been stopped exit the aspiration window loop.
// Sorting and writing PV back to TT is safe becuase RootMoves
// is still valid, although refers to previous iteration.
if (Signals.stop)
break;
- // Send full PV info to GUI if we are going to leave the loop or
- // if we have a fail high/low and we are deep in the search.
- if ((bestValue > alpha && bestValue < beta) || SearchTime.elapsed() > 2000)
- cout << uci_pv(pos, depth, alpha, beta) << endl;
-
// In case of failing high/low increase aspiration window and
// research, otherwise exit the fail high/low loop.
if (bestValue >= beta)
Something went wrong with that request. Please try again.