]> git.sesse.net Git - stockfish/commit
Raise kingDanger threshold and adjust constant term #2087
author31m059 <37052095+31m059@users.noreply.github.com>
Tue, 9 Apr 2019 17:35:17 +0000 (13:35 -0400)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Tue, 9 Apr 2019 17:35:17 +0000 (19:35 +0200)
commitab4b94e1737fcdf9f5174a96e80bbdc985c95267
tree83f34ea89f8f55e9d5673df3d3ffc7c387b095cf
parentf98c77413b68d506977bc078de7a47455968a926
Raise kingDanger threshold and adjust constant term #2087

The kingDanger term is intended to give a penalty which increases rapidly in the middlegame but less so in the endgame. To this end, the middlegame component is quadratic, and the endgame component is linear. However, this produces unintended consequences for relatively small values of kingDanger: the endgame penalty will exceed the middlegame penalty. This remains true up to kingDanger = 256 (a S(16, 16) penalty), so some of these inaccurate penalties are actually rather large.

In this patch, we increase the threshold for applying the kingDanger penalty to eliminate some of this unintended behavior. This was very nearly, but not quite, sufficient to pass on its own. The patch was finally successful by integrating a second kingDanger tweak by @Vizvezdenec, increasing the kingDanger constant term slightly and improving both STC and LTC performance.

Where do we go from here? I propose that in the future, any attempts to tune kingDanger coefficients should also consider tuning the kingDanger threshold. The evidence shows clearly that it should not be automatically taken to be zero.

Special thanks to @Vizvezdenec for the kingDanger constant tweak. Thanks also to all the approvers and CPU donors who made this possible!

STC:
LLR: -2.96 (-2.94,2.94) [0.00,4.00]
Total: 141225 W: 31239 L: 30846 D: 79140
http://tests.stockfishchess.org/tests/view/5cabbdb20ebc5925cf00b86c

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 30708 W: 5296 L: 5043 D: 20369
http://tests.stockfishchess.org/tests/view/5cabff760ebc5925cf00c22d

Bench: 3445945
src/evaluate.cpp