mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Stop earlier if iteration is taking too long
If we are still at first move, without a fail-low and current iteration is taking too long to complete then stop the search. Passed short TC: LLR: 2.97 (-2.94,2.94) [-1.50,4.50] Total: 26030 W: 4959 L: 4785 D: 16286 Long TC: LLR: 2.95 (-2.94,2.94) [0.00,6.00] Total: 18019 W: 2936 L: 2752 D: 12331 And performed well at 40/30 ELO: 4.33 +-2.8 (95%) LOS: 99.9% Total: 20000 W: 3480 L: 3231 D: 13289 bench: 8502826
This commit is contained in:
parent
45dbd9cd03
commit
a5869d8d25
2 changed files with 7 additions and 4 deletions
|
@ -43,7 +43,7 @@ namespace Search {
|
||||||
std::vector<RootMove> RootMoves;
|
std::vector<RootMove> RootMoves;
|
||||||
Position RootPos;
|
Position RootPos;
|
||||||
Color RootColor;
|
Color RootColor;
|
||||||
Time::point SearchTime;
|
Time::point SearchTime, IterationTime;
|
||||||
StateStackPtr SetupStates;
|
StateStackPtr SetupStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,6 +396,8 @@ namespace {
|
||||||
sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl;
|
sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IterationTime = Time::now() - SearchTime;
|
||||||
|
|
||||||
// If skill levels are enabled and time is up, pick a sub-optimal best move
|
// If skill levels are enabled and time is up, pick a sub-optimal best move
|
||||||
if (skill.enabled() && skill.time_to_pick(depth))
|
if (skill.enabled() && skill.time_to_pick(depth))
|
||||||
skill.pick_move();
|
skill.pick_move();
|
||||||
|
@ -429,7 +431,7 @@ namespace {
|
||||||
// Stop the search if most of the available time has been used. We
|
// Stop the search if most of the available time has been used. We
|
||||||
// probably don't have enough time to search the first move at the
|
// probably don't have enough time to search the first move at the
|
||||||
// next iteration anyway.
|
// next iteration anyway.
|
||||||
if (Time::now() - SearchTime > (TimeMgr.available_time() * 62) / 100)
|
if (IterationTime > (TimeMgr.available_time() * 62) / 100)
|
||||||
stop = true;
|
stop = true;
|
||||||
|
|
||||||
// Stop the search early if one move seems to be much better than others
|
// Stop the search early if one move seems to be much better than others
|
||||||
|
@ -1629,7 +1631,8 @@ void check_time() {
|
||||||
Time::point elapsed = Time::now() - SearchTime;
|
Time::point elapsed = Time::now() - SearchTime;
|
||||||
bool stillAtFirstMove = Signals.firstRootMove
|
bool stillAtFirstMove = Signals.firstRootMove
|
||||||
&& !Signals.failedLowAtRoot
|
&& !Signals.failedLowAtRoot
|
||||||
&& elapsed > TimeMgr.available_time();
|
&& elapsed > (TimeMgr.available_time() * 62) / 100
|
||||||
|
&& elapsed > IterationTime * 1.4;
|
||||||
|
|
||||||
bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution
|
bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution
|
||||||
|| stillAtFirstMove;
|
|| stillAtFirstMove;
|
||||||
|
|
|
@ -98,7 +98,7 @@ extern LimitsType Limits;
|
||||||
extern std::vector<RootMove> RootMoves;
|
extern std::vector<RootMove> RootMoves;
|
||||||
extern Position RootPos;
|
extern Position RootPos;
|
||||||
extern Color RootColor;
|
extern Color RootColor;
|
||||||
extern Time::point SearchTime;
|
extern Time::point SearchTime, IterationTime;
|
||||||
extern StateStackPtr SetupStates;
|
extern StateStackPtr SetupStates;
|
||||||
|
|
||||||
extern void init();
|
extern void init();
|
||||||
|
|
Loading…
Add table
Reference in a new issue