mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Tweak time management (failing eval)
Adjust fallingEval with score change in last 5 iterations. FallingEval adjusts the time used on a move depending on whether the position score is better or worse than on the previous move. This change adds a dependency on the score change in the last 5 iterations of the current search. Tests with original code: STC : LLR: 2.97 (-2.94,2.94) [-1.50,4.50] Total: 18728 W: 4170 L: 4005 D: 10553 https://tests.stockfishchess.org/tests/view/5de68a5bb407ee7bfda68a94 LTC : LLR: 2.95 (-2.94,2.94) [0.00,3.50] Total: 180217 W: 29214 L: 28551 D: 122452 https://tests.stockfishchess.org/tests/view/5de690a4b407ee7bfda68a9a Revised code using a simple array instead of a deque and different values gave a slightly quicker pass at LTC. The merged patch now uses this: STC : LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 18616 W: 4114 L: 3950 D: 10552 https://tests.stockfishchess.org/tests/view/5debb790b7bdefd50db28d14 LTC : LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 134151 W: 21729 L: 21191 D: 91231 https://tests.stockfishchess.org/tests/view/5debc13fb7bdefd50db28d19 No functional change
This commit is contained in:
parent
0256416bb7
commit
20484ccdd5
2 changed files with 17 additions and 1 deletions
|
@ -335,6 +335,7 @@ void Thread::search() {
|
|||
MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr);
|
||||
double timeReduction = 1, totBestMoveChanges = 0;
|
||||
Color us = rootPos.side_to_move();
|
||||
int iterIdx = 0;
|
||||
|
||||
std::memset(ss-7, 0, 10 * sizeof(Stack));
|
||||
for (int i = 7; i > 0; i--)
|
||||
|
@ -345,6 +346,16 @@ void Thread::search() {
|
|||
bestValue = delta = alpha = -VALUE_INFINITE;
|
||||
beta = VALUE_INFINITE;
|
||||
|
||||
if (mainThread)
|
||||
{
|
||||
if (mainThread->previousScore == VALUE_INFINITE)
|
||||
for (int i=0; i<4; ++i)
|
||||
mainThread->iterValue[i] = VALUE_ZERO;
|
||||
else
|
||||
for (int i=0; i<4; ++i)
|
||||
mainThread->iterValue[i] = mainThread->previousScore;
|
||||
}
|
||||
|
||||
size_t multiPV = Options["MultiPV"];
|
||||
|
||||
// Pick integer skill levels, but non-deterministically round up or down
|
||||
|
@ -520,7 +531,8 @@ void Thread::search() {
|
|||
&& !Threads.stop
|
||||
&& !mainThread->stopOnPonderhit)
|
||||
{
|
||||
double fallingEval = (354 + 10 * (mainThread->previousScore - bestValue)) / 692.0;
|
||||
double fallingEval = (354 + 6 * (mainThread->previousScore - bestValue)
|
||||
+ 6 * (mainThread->iterValue[iterIdx] - bestValue)) / 692.0;
|
||||
fallingEval = clamp(fallingEval, 0.5, 1.5);
|
||||
|
||||
// If the bestMove is stable over several iterations, reduce time accordingly
|
||||
|
@ -547,6 +559,9 @@ void Thread::search() {
|
|||
Threads.stop = true;
|
||||
}
|
||||
}
|
||||
|
||||
mainThread->iterValue[iterIdx] = bestValue;
|
||||
iterIdx = (iterIdx + 1) & 3;
|
||||
}
|
||||
|
||||
if (!mainThread)
|
||||
|
|
|
@ -88,6 +88,7 @@ struct MainThread : public Thread {
|
|||
|
||||
double previousTimeReduction;
|
||||
Value previousScore;
|
||||
Value iterValue[4];
|
||||
int callsCnt;
|
||||
bool stopOnPonderhit;
|
||||
std::atomic_bool ponder;
|
||||
|
|
Loading…
Add table
Reference in a new issue