]> git.sesse.net Git - stockfish/commitdiff
Adjust time used for move based on previous score
authorLeonid Pechenik <lp@home>
Sun, 3 Jan 2016 14:00:56 +0000 (14:00 +0000)
committerJoona Kiiski <joona@zoox.com>
Sun, 3 Jan 2016 14:01:15 +0000 (14:01 +0000)
Use less time if evaluation is not worse than for previous move and even less time if in addition no fail low encountered for current iteration.

STC: 10+0.1
ELO: 5.37 +-2.9 (95%) LOS: 100.0%
Total: 20000 W: 3832 L: 3523 D: 12645

STC: 10+0.1
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 17527 W: 3334 L: 3132 D: 11061

LTC: 60+0.6
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 28233 W: 3939 L: 3725 D: 20569

LTC: 60+0.6
ELO: 2.43 +-1.4 (95%) LOS: 100.0%
Total: 60000 W: 8266 L: 7847 D: 43887

LTC: 60+0.06
LLR: 2.95 (-2.94,2.94) [-1.00,3.00]
Total: 38932 W: 5408 L: 5207 D: 28317

Resolves #547

src/search.cpp
src/thread.h
src/timeman.cpp
src/timeman.h
src/ucioption.cpp

index 4738b27b2bb980fb4202b988a9c47f740caf91d5..3e9506d7ef9be8f257bd4a7e245e40bb6f1e60b0 100644 (file)
@@ -187,6 +187,8 @@ void Search::clear() {
       th->history.clear();
       th->counterMoves.clear();
   }
+
+  Threads.main()->previousMoveScore = VALUE_INFINITE;
 }
 
 
@@ -337,6 +339,8 @@ void MainThread::search() {
               bestThread = th;
   }
 
+  previousMoveScore = bestThread->rootMoves[0].score;
+
   // Send new PV when needed
   if (bestThread != this)
       sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl;
@@ -536,10 +540,12 @@ void Thread::search() {
               // of the available time has been used or we matched an easyMove
               // from the previous search and just did a fast verification.
               if (   rootMoves.size() == 1
-                  || Time.elapsed() > Time.available() * (mainThread->failedLow ? 641 : 315) / 640
-                  || (mainThread->easyMovePlayed = (   rootMoves[0].pv[0] == easyMove
-                                                    && mainThread->bestMoveChanges < 0.03
-                                                    && Time.elapsed() > Time.available() / 8)))
+                  || Time.elapsed() > Time.available() * ( 640  - 160 * !mainThread->failedLow 
+                     - 126 * (bestValue >= mainThread->previousMoveScore)  
+                     - 124 * (bestValue >= mainThread->previousMoveScore && !mainThread->failedLow))/640
+                  || ( mainThread->easyMovePlayed = ( rootMoves[0].pv[0] == easyMove
+                                                     && mainThread->bestMoveChanges < 0.03
+                                                     && Time.elapsed() > Time.available() * 25/206)))
               {
                   // If we are allowed to ponder do not stop the search now but
                   // keep pondering until the GUI sends "ponderhit" or "stop".
index c1b1815aa39ec0b308728ce752e9e436d924bd46..afae57c3a9b02e7b265584e1cc56e65cc82704f1 100644 (file)
@@ -80,6 +80,7 @@ struct MainThread : public Thread {
 
   bool easyMovePlayed, failedLow;
   double bestMoveChanges;
+  Value previousMoveScore;
 };
 
 
index 2629e967d12b6f6e92311492beca66f418468d92..ba0adea527249b38080288907bc500373bca353b 100644 (file)
@@ -33,8 +33,8 @@ namespace {
   enum TimeType { OptimumTime, MaxTime };
 
   const int MoveHorizon   = 50;   // Plan time management at most this many moves ahead
-  const double MaxRatio   = 6.93;  // When in trouble, we can step over reserved time with this ratio
-  const double StealRatio = 0.36; // However we must not steal time from remaining moves over this ratio
+  const double MaxRatio   = 7.09;  // When in trouble, we can step over reserved time with this ratio
+  const double StealRatio = 0.35; // However we must not steal time from remaining moves over this ratio
 
 
   // move_importance() is a skew-logistic function based on naive statistical
@@ -44,9 +44,9 @@ namespace {
 
   double move_importance(int ply) {
 
-    const double XScale = 8.27;
-    const double XShift = 59.;
-    const double Skew   = 0.179;
+    const double XScale = 7.64;
+    const double XShift = 58.4;
+    const double Skew   = 0.183;
 
     return pow((1 + exp((ply - XShift) / XScale)), -Skew) + DBL_MIN; // Ensure non-zero
   }
index a1d0b310f4c24491eb2439ba892a1649b8116d87..00a3328cf623cdfb17e12cf07648626a28e9ebb4 100644 (file)
@@ -32,7 +32,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.016); }
+  int available() const { return int(optimumTime * unstablePvFactor * 0.968); }
   int maximum() const { return maximumTime; }
   int elapsed() const { return int(Search::Limits.npmsec ? Threads.nodes_searched() : now() - startTime); }
 
index e98049eb38cd41187a25c5376aaa9004e42b2d41..243f11e3f1e1fc09d5df506ac3cefc72807cb45e 100644 (file)
@@ -67,7 +67,7 @@ void init(OptionsMap& o) {
   o["Skill Level"]           << Option(20, 0, 20);
   o["Move Overhead"]         << Option(30, 0, 5000);
   o["Minimum Thinking Time"] << Option(20, 0, 5000);
-  o["Slow Mover"]            << Option(84, 10, 1000);
+  o["Slow Mover"]            << Option(89, 10, 1000);
   o["nodestime"]             << Option(0, 0, 10000);
   o["UCI_Chess960"]          << Option(false);
   o["SyzygyPath"]            << Option("<empty>", on_tb_path);