mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Simplify non-pawn material divisor to a constant
Passed STC: https://tests.stockfishchess.org/tests/view/662942603fe04ce4cefc7aba LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 272832 W: 70456 L: 70497 D: 131879 Ptnml(0-2): 1020, 32619, 69154, 32628, 995 Passed LTC: https://tests.stockfishchess.org/tests/view/662dfe3b6115ff6764c829eb LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 100254 W: 25446 L: 25303 D: 49505 Ptnml(0-2): 121, 11292, 27166, 11419, 129 closes https://github.com/official-stockfish/Stockfish/pull/5198 Bench: 1544645
This commit is contained in:
parent
834e8ff619
commit
48a3b7c0ee
1 changed files with 7 additions and 7 deletions
|
@ -64,14 +64,14 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
|
||||||
? networks.small.evaluate(pos, &caches.small, true, &nnueComplexity, psqtOnly)
|
? networks.small.evaluate(pos, &caches.small, true, &nnueComplexity, psqtOnly)
|
||||||
: networks.big.evaluate(pos, &caches.big, true, &nnueComplexity, false);
|
: networks.big.evaluate(pos, &caches.big, true, &nnueComplexity, false);
|
||||||
|
|
||||||
const auto adjustEval = [&](int optDiv, int nnueDiv, int npmDiv, int pawnCountConstant,
|
const auto adjustEval = [&](int optDiv, int nnueDiv, int pawnCountConstant, int pawnCountMul,
|
||||||
int pawnCountMul, int npmConstant, int evalDiv,
|
int npmConstant, int evalDiv, int shufflingConstant,
|
||||||
int shufflingConstant, int shufflingDiv) {
|
int shufflingDiv) {
|
||||||
// Blend optimism and eval with nnue complexity and material imbalance
|
// Blend optimism and eval with nnue complexity and material imbalance
|
||||||
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / optDiv;
|
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / optDiv;
|
||||||
nnue -= nnue * (nnueComplexity * 5 / 3) / nnueDiv;
|
nnue -= nnue * (nnueComplexity * 5 / 3) / nnueDiv;
|
||||||
|
|
||||||
int npm = pos.non_pawn_material() / npmDiv;
|
int npm = pos.non_pawn_material() / 64;
|
||||||
v = (nnue * (npm + pawnCountConstant + pawnCountMul * pos.count<PAWN>())
|
v = (nnue * (npm + pawnCountConstant + pawnCountMul * pos.count<PAWN>())
|
||||||
+ optimism * (npmConstant + npm))
|
+ optimism * (npmConstant + npm))
|
||||||
/ evalDiv;
|
/ evalDiv;
|
||||||
|
@ -82,11 +82,11 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!smallNet)
|
if (!smallNet)
|
||||||
adjustEval(524, 32395, 66, 942, 11, 139, 1058, 178, 204);
|
adjustEval(524, 32395, 942, 11, 139, 1058, 178, 204);
|
||||||
else if (psqtOnly)
|
else if (psqtOnly)
|
||||||
adjustEval(517, 32857, 65, 908, 7, 155, 1006, 224, 238);
|
adjustEval(517, 32857, 908, 7, 155, 1006, 224, 238);
|
||||||
else
|
else
|
||||||
adjustEval(515, 32793, 63, 944, 9, 140, 1067, 206, 206);
|
adjustEval(515, 32793, 944, 9, 140, 1067, 206, 206);
|
||||||
|
|
||||||
// Guarantee evaluation does not hit the tablebase range
|
// 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);
|
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue