]> git.sesse.net Git - stockfish/commitdiff
Simplify move_importance()
authorH. Felix Wittmann <hfwittmann@gmail.com>
Tue, 31 Dec 2013 11:24:57 +0000 (12:24 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 1 Jan 2014 11:58:10 +0000 (12:58 +0100)
Drop a useless parameter. This works because ratio1 and ratio2
are ratios of linear combinations of thisMoveImportance and
otherMovesImportance and so the yscale cancels out.

Therefore the values of ratio1 and ratio2 are independent
of yscale and yscale can be retired.

The same applies to yshift, but here we want to ensure
move_importance() > 0, so directly hard-code this safety
guard in function definition.

Actually there are some small differences due to rounding errors
and usually are at most few millisecond, that's means below 1% of
returned time, apart from very short intervals in which a difference
of just 1 msec can raise to 2-3% of total available time.

No functional change.

src/timeman.cpp

index 81c2f39b77e4d40eaff30c57dadeeda6f4f2b1be..fc2a327df253528a77ce9f80f1b286728124f93d 100644 (file)
@@ -34,8 +34,6 @@ namespace {
 
   const double xscale     = 9.3;
   const double xshift     = 59.8;
-  const double yscale     = 7780;
-  const double yshift     = 1e-3; // Larger than 0. Ensures a non-zero importance
   const double skewfactor = 0.172;
 
 
@@ -46,7 +44,7 @@ namespace {
 
   double move_importance(int ply) {
 
-    return yscale / pow((1 + exp((ply - xshift) / xscale)), skewfactor) + yshift;
+    return 1 / pow((1 + exp((ply - xshift) / xscale)), skewfactor) + 1e-3; // Ensure non-zero
   }