fixed time control management

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Daniel Shawul
Posts: 3572
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

fixed time control management

Post by Daniel Shawul » Sat Feb 01, 2014 7:57 pm

In a fixed time control (with/without increments) I set fixed number of moves left (35) to calculate search time. Changing this to something dynamic that assumes chess games end in 40 moves on average performed much better to my surprize. It got +30 elo on short time controls (game in 40sec), but as we know time management changes are very sensitive and this could easily evaporate on a bit longer time control.

Code: Select all

if&#40;move_no <= 25&#41; moves_left = 40 - move_no;
else moves_left = 15;
search_time = p_time / moves_left + inc;
I used to set moves_left = 30 before for all phases, but this new scheme plays faster towards the endgame. I wish this could translate to the standard time controls ( 40 moves in X minutes)as well, but so far uniform time allocation is still good there. Thought I had stepped on a gold mine there, but probably a trickery peat :)

AlvaroBegue
Posts: 913
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: fixed time control management

Post by AlvaroBegue » Sat Feb 01, 2014 9:20 pm

You also need to make it a bit smarter, by making the numbers depend on the setting of the "ponder" option: You can be somewhat more aggressive in consuming time if every so often you'll save some time because of a ponder hit.

User avatar
Evert
Posts: 2909
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: fixed time control management

Post by Evert » Sat Feb 01, 2014 9:58 pm

Interesting. I've always done what you're doing now (let number of assumed remaining moves depend on the number of moves played already), and I decided to see if I could simplify by just setting a constant number of moves remaining instead. It was a clear regression.

User avatar
hgm
Posts: 23012
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: fixed time control management

Post by hgm » Sun Feb 02, 2014 8:02 am

It would be more logical to not let the remaining-moves estimate depend on the absolute move number, but on the game phase. In mini-Shogi, where there isn't really a game phase (because it is a drop game like Crazyhouse), I use the score to estimate remaining move. The farther you are from equality, the quicker you expect the game to end.

I do this dynamically: rather than deciding before the search how long I want to think, it re-calculates the limit on every clock read, based on the most recent root score.

In orthodox Chess, with so many games available, it should of course be easy to take statistics. The main difficulty is deciding when games are decided. In any game there comes a situation where you can win it against perfect play in virtually zero time, but for games played upto checkmate, this might still take most of the moves. You want to distribute the remaining time over the moves where there was still something to think about, If you could determine that point in every game, it would be easy to determine the distribution of remaining moves for each given (game-phase, score imbalance) pair.

zamar
Posts: 613
Joined: Sun Jan 18, 2009 6:03 am

Re: fixed time control management

Post by zamar » Sun Feb 02, 2014 9:02 am

hgm wrote:
In orthodox Chess, with so many games available, it should of course be easy to take statistics. The main difficulty is deciding when games are decided. In any game there comes a situation where you can win it against perfect play in virtually zero time, but for games played upto checkmate, this might still take most of the moves. You want to distribute the remaining time over the moves where there was still something to think about, If you could determine that point in every game, it would be easy to determine the distribution of remaining moves for each given (game-phase, score imbalance) pair.
In Stockfish, the statics were taken wit assumption that the game is decided when either side has >275cp advantage. This works fine for short, medium and long time controls. But not for hyper blitz.
Joona Kiiski

thomasahle
Posts: 51
Joined: Thu Feb 27, 2014 7:19 pm

Re: fixed time control management

Post by thomasahle » Wed Mar 05, 2014 10:25 pm

My statistics, posted here, suggest that your approximation is pretty good. Only try updating the constants as

Code: Select all

if&#40;move_no <= 20&#41; moves_left = 45 - move_no; 
else moves_left = 25; 
It would be interesting to make a regression over the function (moves_played, material_total, material_difference) -> moves_left. Seems like you'd be able to get something pretty precise. Maybe also take the time controls into consideration.

Daniel Shawul
Posts: 3572
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

Re: fixed time control management

Post by Daniel Shawul » Thu Mar 06, 2014 7:58 am

Nice. I will try the log-normal formula and see if i I get an improvement.
Thanks.

thomasahle
Posts: 51
Joined: Thu Feb 27, 2014 7:19 pm

Re: fixed time control management

Post by thomasahle » Thu Mar 06, 2014 8:29 am

Depending on what time controls you are going to use your engine with, you might also try with a different dataset.

Adam Hair
Posts: 3199
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Re: fixed time control management

Post by Adam Hair » Thu Mar 06, 2014 11:38 am

thomasahle wrote:My statistics, posted here, suggest that your approximation is pretty good. Only try updating the constants as

Code: Select all

if&#40;move_no <= 20&#41; moves_left = 45 - move_no; 
else moves_left = 25; 
It would be interesting to make a regression over the function (moves_played, material_total, material_difference) -> moves_left. Seems like you'd be able to get something pretty precise. Maybe also take the time controls into consideration.
Interesting. The same data for computer matches is similar in that it is also approximately lognormal, but the length of the games is longer:

CCRL 40/4
mean=141 (half moves)
median=129
mode=115

CCRL 40/40 (early adjudication is commonly used for these games)
mean=137
median=126
mode=122

bob
Posts: 20358
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: fixed time control management

Post by bob » Thu Mar 06, 2014 4:43 pm

Daniel Shawul wrote:In a fixed time control (with/without increments) I set fixed number of moves left (35) to calculate search time. Changing this to something dynamic that assumes chess games end in 40 moves on average performed much better to my surprize. It got +30 elo on short time controls (game in 40sec), but as we know time management changes are very sensitive and this could easily evaporate on a bit longer time control.

Code: Select all

if&#40;move_no <= 25&#41; moves_left = 40 - move_no;
else moves_left = 15;
search_time = p_time / moves_left + inc;
I used to set moves_left = 30 before for all phases, but this new scheme plays faster towards the endgame. I wish this could translate to the standard time controls ( 40 moves in X minutes)as well, but so far uniform time allocation is still good there. Thought I had stepped on a gold mine there, but probably a trickery peat :)
I think this divisor is much less important that paying attention to the game, and adjusting the target time on the fly, as I am doing in Crafty. If you change your mind a couple of times during an iteration, ramp up the target. If you stick with the same move, iteration after iteration, reduce the target. I tested this over many games last year, it it helps much more than just increasing or decreasing the target time uniformly based on some static criteria.

Post Reply