1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Simplify optimism calculation

This change removes one of the constants in the calculation of optimism. It also changes the 2 constants used with the scale value so that they are independent, instead of applying a constant to the scale and then adjusting it again when it is applied to the optimism. This might make the tuning of these constants cleaner and more reliable in the future.

STC 10+0.1 (accidentally run as an Elo gainer:
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 154080 W: 41119 L: 40651 D: 72310
Ptnml(0-2): 375, 16840, 42190, 17212, 423
https://tests.stockfishchess.org/tests/live_elo/64653eabf3b1a4e86c317f77

LTC 60+0.6:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 217434 W: 58382 L: 58363 D: 100689
Ptnml(0-2): 66, 21075, 66419, 21088, 69
https://tests.stockfishchess.org/tests/live_elo/6465d077f3b1a4e86c318d6c

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

bench: 3190961
This commit is contained in:
xoto10 2023-05-19 19:58:18 +01:00 committed by Joost VandeVondele
parent 4f24ee0868
commit 4b085c4777

View file

@ -1063,7 +1063,7 @@ Value Eval::evaluate(const Position& pos) {
else
{
int nnueComplexity;
int scale = 967 + pos.non_pawn_material() / 64;
int npm = pos.non_pawn_material() / 64;
Color stm = pos.side_to_move();
Value optimism = pos.this_thread()->optimism[stm];
@ -1071,12 +1071,12 @@ Value Eval::evaluate(const Position& pos) {
Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);
// Blend nnue complexity with (semi)classical complexity
nnueComplexity = ( 402 * nnueComplexity
+ (454 + optimism) * abs(psq - nnue)
nnueComplexity = ( 397 * nnueComplexity
+ (477 + optimism) * abs(psq - nnue)
) / 1024;
optimism = optimism * (274 + nnueComplexity) / 256;
v = (nnue * scale + optimism * (scale - 791)) / 1024;
optimism += optimism * nnueComplexity / 256;
v = (nnue * (945 + npm) + optimism * (174 + npm)) / 1024;
}
// Damp down the evaluation linearly when shuffling