Skip to content

Commit aedebe3

Browse files
Leonid Pechenikzamar
Leonid Pechenik
authored andcommitted
Time management simplification
10+0.1: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 41963 W: 7967 L: 7883 D: 26113 60+0.6: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 132314 W: 17939 L: 17969 D: 96406 Resolves #580
1 parent 9a10313 commit aedebe3

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/search.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,24 +544,21 @@ void Thread::search() {
544544
{
545545
if (!Signals.stop && !Signals.stopOnPonderhit)
546546
{
547-
// Take some extra time if the best move has changed
548-
if (rootDepth > 4 * ONE_PLY && multiPV == 1)
549-
Time.pv_instability(mainThread->bestMoveChanges);
550-
551547
// Stop the search if only one legal move is available, or if all
552548
// of the available time has been used, or if we matched an easyMove
553549
// from the previous search and just did a fast verification.
554550
const bool F[] = { !mainThread->failedLow,
555551
bestValue >= mainThread->previousScore };
556552

557553
int improvingFactor = 640 - 160*F[0] - 126*F[1] - 124*F[0]*F[1];
554+
double unstablePvFactor = 1 + mainThread->bestMoveChanges;
558555

559556
bool doEasyMove = rootMoves[0].pv[0] == easyMove
560557
&& mainThread->bestMoveChanges < 0.03
561-
&& Time.elapsed() > Time.available() * 25 / 206;
558+
&& Time.elapsed() > Time.optimum() * 25 / 204;
562559

563560
if ( rootMoves.size() == 1
564-
|| Time.elapsed() > Time.available() * improvingFactor / 640
561+
|| Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 634
565562
|| (mainThread->easyMovePlayed = doEasyMove))
566563
{
567564
// If we are allowed to ponder do not stop the search now but

src/timeman.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ void TimeManagement::init(Search::LimitsType& limits, Color us, int ply)
104104
}
105105

106106
startTime = limits.startTime;
107-
unstablePvFactor = 1;
108107
optimumTime = maximumTime = std::max(limits.time[us], minThinkingTime);
109108

110109
const int MaxMTG = limits.movestogo ? std::min(limits.movestogo, MoveHorizon) : MoveHorizon;

src/timeman.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
class TimeManagement {
3232
public:
3333
void init(Search::LimitsType& limits, Color us, int ply);
34-
void pv_instability(double bestMoveChanges) { unstablePvFactor = 1 + bestMoveChanges; }
35-
int available() const { return int(optimumTime * unstablePvFactor * 1.01); }
34+
int optimum() const { return optimumTime; }
3635
int maximum() const { return maximumTime; }
3736
int elapsed() const { return int(Search::Limits.npmsec ? Threads.nodes_searched() : now() - startTime); }
3837

@@ -42,7 +41,6 @@ class TimeManagement {
4241
TimePoint startTime;
4342
int optimumTime;
4443
int maximumTime;
45-
double unstablePvFactor;
4644
};
4745

4846
extern TimeManagement Time;

0 commit comments

Comments
 (0)