Tuning classical and NNUE scaling terms

changes to parameters in both classical and NNUE scaling, following up from an earlier successful #3958

passed STC:
LLR: 2.95 (-2.94,2.94) <0.00,2.50>
Total: 23936 W: 6490 L: 6234 D: 11212
Ptnml(0-2): 107, 2610, 6306, 2810, 135
https://tests.stockfishchess.org/tests/view/625820aa33c40bb9d964e6ae

passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,3.00>
Total: 50376 W: 13629 L: 13327 D: 23420
Ptnml(0-2): 20, 4979, 14920, 5217, 52
https://tests.stockfishchess.org/tests/view/62584592c1d7f5008a33a4d1

closes https://github.com/official-stockfish/Stockfish/pull/3982

Bench: 6964954
This commit is contained in:
FauziAkram
2022-04-12 20:45:25 +03:00
committed by Joost VandeVondele
parent c3b67faf98
commit c25d4c4887
2 changed files with 24 additions and 24 deletions
+5 -5
View File
@@ -198,12 +198,12 @@ namespace {
constexpr Value SpaceThreshold = Value(11551);
// KingAttackWeights[PieceType] contains king attack weights by piece type
constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 };
constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 76, 46, 45, 14 };
// SafeCheck[PieceType][single/multiple] contains safe check bonus by piece type,
// higher if multiple safe checks are possible for that piece type.
constexpr int SafeCheck[][2] = {
{}, {}, {803, 1292}, {639, 974}, {1087, 1878}, {759, 1132}
{}, {}, {805, 1292}, {650, 984}, {1071, 1886}, {730, 1128}
};
#define S(mg, eg) make_score(mg, eg)
@@ -1089,7 +1089,7 @@ Value Eval::evaluate(const Position& pos) {
// but we switch to NNUE during long shuffling or with high material on the board.
if ( !useNNUE
|| ((pos.this_thread()->depth > 9 || pos.count<ALL_PIECES>() > 7) &&
abs(eg_value(pos.psq_score())) * 5 > (856 + pos.non_pawn_material() / 64) * (5 + pos.rule50_count())))
abs(eg_value(pos.psq_score())) * 5 > (856 + pos.non_pawn_material() / 64) * (10 + pos.rule50_count())))
{
v = Evaluation<NO_TRACE>(pos).value(); // classical
useClassical = abs(v) >= 297;
@@ -1099,7 +1099,7 @@ Value Eval::evaluate(const Position& pos) {
if (useNNUE && !useClassical)
{
Value nnue = NNUE::evaluate(pos, true); // NNUE
int scale = 1036 + 20 * pos.non_pawn_material() / 1024;
int scale = 1036 + 22 * pos.non_pawn_material() / 1024;
Color stm = pos.side_to_move();
Value optimism = pos.this_thread()->optimism[stm];
Value psq = (stm == WHITE ? 1 : -1) * eg_value(pos.psq_score());
@@ -1113,7 +1113,7 @@ Value Eval::evaluate(const Position& pos) {
}
// Damp down the evaluation linearly when shuffling
v = v * (207 - pos.rule50_count()) / 207;
v = v * (195 - pos.rule50_count()) / 211;
// Guarantee evaluation does not hit the tablebase range
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);