From e1972e5b72ed06340eba24d1e4af3d2984c3be55 Mon Sep 17 00:00:00 2001 From: Leonid Pechenik Date: Mon, 18 Jan 2016 11:56:35 -0500 Subject: [PATCH] simplification --- src/search.cpp | 9 +++------ src/timeman.cpp | 1 - src/timeman.h | 4 +--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index a4bf172a99e..c632e74731b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -531,10 +531,6 @@ void Thread::search() { { if (!Signals.stop && !Signals.stopOnPonderhit) { - // Take some extra time if the best move has changed - if (rootDepth > 4 * ONE_PLY && multiPV == 1) - Time.pv_instability(mainThread->bestMoveChanges); - // Stop the search if only one legal move is available, or if all // of the available time has been used, or if we matched an easyMove // from the previous search and just did a fast verification. @@ -542,13 +538,14 @@ void Thread::search() { bestValue >= mainThread->previousScore }; int improvingFactor = 640 - 160*F[0] - 126*F[1] - 124*F[0]*F[1]; + double unstablePvFactor = 1 + mainThread->bestMoveChanges; bool doEasyMove = rootMoves[0].pv[0] == easyMove && mainThread->bestMoveChanges < 0.03 - && Time.elapsed() > Time.available() * 25 / 206; + && Time.elapsed() > Time.optimum() * 25 / 204; if ( rootMoves.size() == 1 - || Time.elapsed() > Time.available() * improvingFactor / 640 + || Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 634 || (mainThread->easyMovePlayed = doEasyMove)) { // If we are allowed to ponder do not stop the search now but diff --git a/src/timeman.cpp b/src/timeman.cpp index 0bc9c159bbe..bc9c2e5b4b7 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -104,7 +104,6 @@ void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) } startTime = limits.startTime; - unstablePvFactor = 1; optimumTime = maximumTime = std::max(limits.time[us], minThinkingTime); const int MaxMTG = limits.movestogo ? std::min(limits.movestogo, MoveHorizon) : MoveHorizon; diff --git a/src/timeman.h b/src/timeman.h index 0da083dc6bd..9930a4b7190 100644 --- a/src/timeman.h +++ b/src/timeman.h @@ -31,8 +31,7 @@ class TimeManagement { public: void init(Search::LimitsType& limits, Color us, int ply); - void pv_instability(double bestMoveChanges) { unstablePvFactor = 1 + bestMoveChanges; } - int available() const { return int(optimumTime * unstablePvFactor * 1.01); } + int optimum() const { return optimumTime; } int maximum() const { return maximumTime; } int elapsed() const { return int(Search::Limits.npmsec ? Threads.nodes_searched() : now() - startTime); } @@ -42,7 +41,6 @@ class TimeManagement { TimePoint startTime; int optimumTime; int maximumTime; - double unstablePvFactor; }; extern TimeManagement Time;