Answers.Body: <p>You'll need to give the engine more time to think.</p>
  
  <p><strong>Edited</strong></p>
  
  <p>The poster was concern about <em>"upperbound"/"lowerbound" is only returned at the largest depth"</em>.</p>
  
  <p>The question makes absolutely no sense. I don't want to get into too much technical details because you need to understand the alpha-beta algorithm. upperbound/lowerbound is <strong>NOT</strong> something that an end-user ever needs to worry about. It's meant for engine debugging, the information is only and only useful for engine developers. No chess software with a Stockfish engine would tell you anything related to the bounds. Stockfish reports the upperbound/lowerbound information whenever it encounters one for every 3 seconds.</p>
  
  <p>I can't directly answer your question because it is not a valid question. upper and lower bounds are really not something that you should worry. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T20:21:36.893Z
Answers.Text: Can we guarantee that "upperbound"/"lowerbound" is only returned at the largest depth?
Answers.UserDisplayName: tba
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-25T06:09:18.973Z
Answers.Text: Thanks for your help so far. To rephrase my question: How can I extract the final evaluation of "1.e4" from the above output? It is incorrect to use `cat engine_output.txt | grep "multipv 3" | tail -1 | grep -o "score [^ ]* [^ ]*"` . Is it correct to use `cat engine_output.txt | grep "multipv 3" | grep -v "bound" | tail -1 | grep -o "score [^ ]* [^ ]*"` ? Or should I be using a different UCI command altogether?
Answers.UserDisplayName: tba
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-25T12:36:30.960Z
Answers.Text: This is a chess site. Your question is more about unix scripting. You'd need to ask on stackoverflow.
Answers.UserDisplayName: SmallChess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-25T17:37:16.500Z
Answers.Text: In the output I provided, is the final evaluation of "1.e4" equal to +0.13?
Answers.UserDisplayName: tba
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-26T19:28:52.000Z
Answers.Text: @tba Yes, the search of 1.e4 at depth 13 was completed and gave evaluation +0.13; the search of 1.e4 at depth 14 was not completed because of time limit. So, the final evaluation (at depth 13) is +0.13.
Answers.UserDisplayName: JiK
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T00:00:22.550Z
Answers.LastActivityDate: 2014-10-25T03:10:33.920Z
Answers.LastEditDate: 2014-10-25T03:10:33.920Z
Answers.UserDisplayName: SmallChess
Body: <p>For a given position, I'd like to compute an evaluation of the 3 best moves.
  I send this to Stockfish:</p>
  
  <pre><code>setoption name MultiPV value 3
  position startpos
  go movetime 500.0 // search for 0.5 seconds
  </code></pre>
  
  <p>I get the following result:</p>
  
  <pre><code>info depth 1 seldepth 1 score cp 84 nodes 71 nps 35500 time 2 multipv 1 pv e2e4
  info depth 1 seldepth 1 score cp 80 nodes 71 nps 35500 time 2 multipv 2 pv d2d4
  info depth 1 seldepth 1 score cp 72 nodes 71 nps 35500 time 2 multipv 3 pv e2e3
  [...]
  info depth 13 seldepth 17 score cp 20 nodes 521614 nps 1575873 time 331 multipv 1 pv d2d4 d7d5 b1c3 g8f6 g1f3 e7e6 e2e3 b8c6 f1d3 f8d6 e1g1 e8g8 c1d2 c8d7 c3b5 e6e5
  info depth 13 seldepth 17 score cp 20 nodes 521614 nps 1575873 time 331 multipv 2 pv g1f3 d7d5 d2d4 g8f6 b1c3 e7e6 e2e3 b8c6 f1d3 f8d6 e1g1 e8g8 c1d2 c8d7 c3b5 e6e5
  info depth 13 seldepth 17 score cp 13 nodes 521614 nps 1575873 time 331 multipv 3 pv e2e4 e7e5 g1e2 b8c6 d2d4 e5d4 e2d4 g8f6 b1c3 f8b4 d4c6 b7c6 e4e5 f6d5
  info depth 14 seldepth 18 score cp 15 nodes 771138 nps 1536131 time 502 multipv 1 pv d2d4 d7d5 g1f3 g8f6 e2e3 e7e6 f1d3 b8c6
  info depth 14 seldepth 18 score cp 15 nodes 771138 nps 1536131 time 502 multipv 2 pv g1f3 d7d5 d2d4 g8f6 e2e3 e7e6 f1d3 b8c6
  info depth 14 seldepth 18 score mate 0 upperbound nodes 771138 nps 1536131 time 502 multipv 3 pv e2e4 e7e5 g1e2 b8c6 d2d4 e5d4 e2d4 g8f6 b1c3 f8b4 d4c6 b7c6 e4e5 f6d5
  info nodes 771138 time 502
  bestmove d2d4 ponder d7d5
  </code></pre>
  
  <p>The line <code>info depth 14 seldepth 18 score mate 0 upperbound ... multipv 3 pv e2e4 ...</code> is not useful to me. It indicates that "1.e4" was pruned from the evaluation -- Since it's worse than "1.d4" or "1.Nf3", it was assigned the trivial upper bound of <code>mate 0</code>.</p>
  
  <p>How can I prevent this from happening? I want an evaluation for each of the top 3 moves, not simply an upper/lower bound. One solution is to run another analysis from <code>position startpos e2e4</code>. Is there a simpler way?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-23T11:27:03.463Z
Comments.Text: Because you have limited search time, there's no way to get any more information at depth 14. What does the output at depth 13 say?
Comments.UserDisplayName: JiK
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-10-24T20:21:15.740Z
Comments.Text: The output at depth 13 looks OK in this case. Does this always hold? Can we guarantee that "upperbound"/"lowerbound" is only returned at the largest depth?
Comments.UserDisplayName: tba
Tags: <engines><evaluation><stockfish><uci>
Title: Stop SF MultiPV from returning an upperbound
ThreadText: # Stop SF MultiPV from returning an upperbound
  
  (Asked by: username_0 on 2014-10-22)
  
  For a given position, I'd like to compute an evaluation of the 3 best moves.
  I send this to Stockfish:
  
  ```
  setoption name MultiPV value 3
  position startpos
  go movetime 500.0 // search for 0.5 seconds
  
  ```
  
  I get the following result:
  
  ```
  info depth 1 seldepth 1 score cp 84 nodes 71 nps 35500 time 2 multipv 1 pv e2e4
  info depth 1 seldepth 1 score cp 80 nodes 71 nps 35500 time 2 multipv 2 pv d2d4
  info depth 1 seldepth 1 score cp 72 nodes 71 nps 35500 time 2 multipv 3 pv e2e3
  [...]
  info depth 13 seldepth 17 score cp 20 nodes 521614 nps 1575873 time 331 multipv 1 pv d2d4 d7d5 b1c3 g8f6 g1f3 e7e6 e2e3 b8c6 f1d3 f8d6 e1g1 e8g8 c1d2 c8d7 c3b5 e6e5
  info depth 13 seldepth 17 score cp 20 nodes 521614 nps 1575873 time 331 multipv 2 pv g1f3 d7d5 d2d4 g8f6 b1c3 e7e6 e2e3 b8c6 f1d3 f8d6 e1g1 e8g8 c1d2 c8d7 c3b5 e6e5
  info depth 13 seldepth 17 score cp 13 nodes 521614 nps 1575873 time 331 multipv 3 pv e2e4 e7e5 g1e2 b8c6 d2d4 e5d4 e2d4 g8f6 b1c3 f8b4 d4c6 b7c6 e4e5 f6d5
  info depth 14 seldepth 18 score cp 15 nodes 771138 nps 1536131 time 502 multipv 1 pv d2d4 d7d5 g1f3 g8f6 e2e3 e7e6 f1d3 b8c6
  info depth 14 seldepth 18 score cp 15 nodes 771138 nps 1536131 time 502 multipv 2 pv g1f3 d7d5 d2d4 g8f6 e2e3 e7e6 f1d3 b8c6
  info depth 14 seldepth 18 score mate 0 upperbound nodes 771138 nps 1536131 time 502 multipv 3 pv e2e4 e7e5 g1e2 b8c6 d2d4 e5d4 e2d4 g8f6 b1c3 f8b4 d4c6 b7c6 e4e5 f6d5
  info nodes 771138 time 502
  bestmove d2d4 ponder d7d5
  
  ```
  
  The line `info depth 14 seldepth 18 score mate 0 upperbound ... multipv 3 pv e2e4 ...` is not useful to me. It indicates that "1.e4" was pruned from the evaluation -- Since it's worse than "1.d4" or "1.Nf3", it was assigned the trivial upper bound of `mate 0`.
  
  How can I prevent this from happening? I want an evaluation for each of the top 3 moves, not simply an upper/lower bound. One solution is to run another analysis from `position startpos e2e4`. Is there a simpler way?
  
  **Tags:** engines, evaluation, stockfish, uci
  
  > **Comments:**
  > **username_1**: Because you have limited search time, there's no way to get any more information at depth 14. What does the output at depth 13 say?  
  > **username_0**: The output at depth 13 looks OK in this case. Does this always hold? Can we guarantee that "upperbound"/"lowerbound" is only returned at the largest depth?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-10-24. Score: 1 | Accepted answer
  
  You'll need to give the engine more time to think.
  
  **Edited**
  
  The poster was concern about *"upperbound"/"lowerbound" is only returned at the largest depth"*.
  
  The question makes absolutely no sense. I don't want to get into too much technical details because you need to understand the alpha-beta algorithm. upperbound/lowerbound is **NOT** something that an end-user ever needs to worry about. It's meant for engine debugging, the information is only and only useful for engine developers. No chess software with a Stockfish engine would tell you anything related to the bounds. Stockfish reports the upperbound/lowerbound information whenever it encounters one for every 3 seconds.
  
  I can't directly answer your question because it is not a valid question. upper and lower bounds are really not something that you should worry.
  
  > **Comments:**
  > **username_0**: Can we guarantee that "upperbound"/"lowerbound" is only returned at the largest depth?  
  > **username_0**: Thanks for your help so far. To rephrase my question: How can I extract the final evaluation of "1.e4" from the above output? It is incorrect to use `cat engine_output.txt | grep "multipv 3" | tail -1 | grep -o "score [^ ]* [^ ]*"` . Is it correct to use `cat engine_output.txt | grep "multipv 3" | grep -v "bound" | tail -1 | grep -o "score [^ ]* [^ ]*"` ? Or should I be using a different UCI command altogether?  
  > **username_2**: This is a chess site. Your question is more about unix scripting. You'd need to ask on stackoverflow.  
  > **username_0**: In the output I provided, is the final evaluation of "1.e4" equal to +0.13?  
  > **username_1**: @username_0 Yes, the search of 1.e4 at depth 13 was completed and gave evaluation +0.13; the search of 1.e4 at depth 14 was not completed because of time limit. So, the final evaluation (at depth 13) is +0.13.  
  
  ---
  
  