Stockfish time management is BADLY broken

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

gerold
Posts: 10121
Joined: Thu Mar 09, 2006 12:57 am
Location: van buren,missouri

Re: Stockfish time management is BADLY broken

Post by gerold »

Jouni wrote:I tried to play 22.9.2017 version with 60 moves in minute level. I must stop, when 15% of games were lost by time against Houdini.
Example game:

[pgn]
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Houdini 6 x64-pext"]
[Black "Stockfish 220917 64 BMI2"]
[Result "1-0"]
[SetUp "1"]
[FEN "rn1qkbnr/pp1bpppp/3p4/1Bp5/4P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 1"]
[PlyCount "119"]

1. c4 Nf6 2. Nc3 Bxb5 3. cxb5 a6 4. bxa6 Nxa6 5. d4 e6 6. Be3 Be7 7. O-O O-O 8.
a3 Ng4 9. Qb3 Nxe3 10. fxe3 Rb8 11. Qa4 Qb6 12. Rf2 Qc6 13. Qxc6 bxc6 14. Rc2
d5 15. g3 Rfc8 16. Kg2 c4 17. Rf1 Rb6 18. Rff2 Nc7 19. Na4 Ra6 20. Nc3 Nb5 21.
Nxb5 cxb5 22. Nd2 Rd8 23. Nb1 dxe4 24. Nc3 Rb6 25. Nxe4 f5 26. Nc3 Kf7 27. h3
g6 28. g4 Bg5 29. Kf3 Ke7 30. Rce2 Rf8 31. Kg3 Bf6 32. Rf1 Ra8 33. Kf4 Ra5 34.
Rd1 b4 35. axb4 Rxb4 36. gxf5 gxf5 37. e4 Bxd4 38. Nd5+ exd5 39. exd5+ Kd6 40.
Rxd4 Rxd5 41. Rxd5+ Kxd5 42. Kxf5 Kd4 43. Kg5 Kd3 44. Rg2 Kd4 45. Re2 c3 46.
bxc3+ Kxc3 47. Re7 Rb5+ 48. Kh6 Kd4 49. h4 Rf5 50. h5 Kd5 51. Rxh7 Ke6 52. Rg7
Kf6 53. Rg1 Kf7 54. Ra1 Kg8 55. Kg6 Rf7 56. h6 Rg7+ 57. Kf5 Rf7+ 58. Kg6 Rg7+
59. Kf5 Rb7 60. Kg6 1-0

[/pgn]

This game was draw already 10 moves before time control (I have syzygy installed and cached to RAM) :o.
I have been using SF in Arena for years. Now using the latest SF vs.other top engines. I have had no problem with the time control. Works great. and beats all other engines at all time controls.
SF is number one in all my tests.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: Stockfish time management is BADLY broken

Post by syzygy »

gerold wrote:I have been using SF in Arena for years. Now using the latest SF vs.other top engines. I have had no problem with the time control. Works great. and beats all other engines at all time controls.
SF is number one in all my tests.
Try SF at 60 moves per X time. And not SF8 but current or at least a very recent SF-dev.
stavros
Posts: 165
Joined: Tue Dec 02, 2014 1:29 am

Re: Stockfish time management is BADLY broken

Post by stavros »

only at 60 time contro?l or for all TC 40/3 40/40 etc?
Norm Pollock
Posts: 1056
Joined: Thu Mar 09, 2006 4:15 pm
Location: Long Island, NY, USA

Re: Stockfish time management is BADLY broken

Post by Norm Pollock »

syzygy wrote:
Damir wrote:Let's hope Stockfish not start losing on time, like in the previous TCEC, 2-3 seasons back.. Stockfish time menagement must be fixed.
It will probably survive in games with a fixed increment per move.

But after a more in depth look at the code, I can only conclude it is totally broken at time controls like 60 moves per 2 hours. For example, at move 52 it might use all of the remaining time except for 100ms Move Overhead. It will then try not to touch that remaining 100ms in the last 8 moves before the increment. So if it does not get flagged, it will blunder anyway.
I am am quite surprised that this problem has not been fixed by now.
Evidently this has not been properly reviewed and tested before it was committed.
Looks like they might be saying that adjudication hid the bug.

Code: Select all

Author: IIvec
Date: Sun Oct 22 07:43:37 2017 +0200
Timestamp: 1508651017

Fix premature using of all available time in x/y TC

In x/y time controls there was a theoretical possibility
to use all available time few moves before the clock will
be updated with new time. This patch fixes that issue.

Tested at 60/15 time control:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 113963 W: 20008 L: 20042 D: 73913

The test was done without adjudication rules!

Bench 5234652 
Updated links for 40H Tools and Databases
http://40Hchess.epizy.com
http://nk-qy.info/40h
User avatar
Zerbinati
Posts: 122
Joined: Mon Aug 18, 2014 7:12 pm
Location: Trento (Italy)

Re: Stockfish time management is BADLY broken

Post by Zerbinati »

corres wrote:If you like old time manager of Stockfish you can return it an easy way:

1. Copy from the Stockfish source before Aug 17 into the newer source
the next three files:
- timeman.cpp
- timeman.h
- ucioption.cpp
and overwrite.

2. In the ucioption.cpp modify the next line:
void on_threads(const Option&) { Threads.read_uci_options(); }
as the follows:
void on_threads(const Option& o) { Threads.set(o); }

3. Compile the source.

That is all.
timeman.h has not undergone any changes