mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Simplify tm, removing faster 1st move and 1.13 extraTime.
Passed STC 10+0.1 : LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 349760 W: 90112 L: 90231 D: 169417 Ptnml(0-2): 784, 37970, 97496, 37841, 789 https://tests.stockfishchess.org/tests/view/665aeee00223e235f05b7d21 Passed LTC 60+0.6 : LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 140082 W: 35463 L: 35370 D: 69249 Ptnml(0-2): 59, 13492, 42851, 13575, 64 https://tests.stockfishchess.org/tests/view/665b15e78da109e362924e5a closes https://github.com/official-stockfish/Stockfish/pull/5334 No functional change
This commit is contained in:
parent
180cab4438
commit
b009c43254
5 changed files with 9 additions and 21 deletions
|
@ -160,8 +160,7 @@ void Search::Worker::start_searching() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
main_manager()->tm.init(limits, rootPos.side_to_move(), rootPos.game_ply(), options,
|
main_manager()->tm.init(limits, rootPos.side_to_move(), rootPos.game_ply(), options, main_manager()->originalTimeAdjust);
|
||||||
main_manager()->originalPly, main_manager()->originalTimeAdjust);
|
|
||||||
tt.new_search();
|
tt.new_search();
|
||||||
|
|
||||||
if (rootMoves.empty())
|
if (rootMoves.empty())
|
||||||
|
|
|
@ -209,7 +209,6 @@ class SearchManager: public ISearchManager {
|
||||||
|
|
||||||
Stockfish::TimeManagement tm;
|
Stockfish::TimeManagement tm;
|
||||||
double originalTimeAdjust;
|
double originalTimeAdjust;
|
||||||
int originalPly;
|
|
||||||
int callsCnt;
|
int callsCnt;
|
||||||
std::atomic_bool ponder;
|
std::atomic_bool ponder;
|
||||||
|
|
||||||
|
|
|
@ -213,12 +213,13 @@ void ThreadPool::clear() {
|
||||||
for (auto&& th : threads)
|
for (auto&& th : threads)
|
||||||
th->wait_for_search_finished();
|
th->wait_for_search_finished();
|
||||||
|
|
||||||
|
// These two affect the time taken on the first move of a game:
|
||||||
|
main_manager()->bestPreviousAverageScore = VALUE_INFINITE;
|
||||||
|
main_manager()->previousTimeReduction = 0.85;
|
||||||
|
|
||||||
main_manager()->callsCnt = 0;
|
main_manager()->callsCnt = 0;
|
||||||
main_manager()->bestPreviousScore = VALUE_INFINITE;
|
main_manager()->bestPreviousScore = VALUE_INFINITE;
|
||||||
main_manager()->bestPreviousAverageScore = VALUE_INFINITE;
|
|
||||||
main_manager()->originalPly = -1;
|
|
||||||
main_manager()->originalTimeAdjust = -1;
|
main_manager()->originalTimeAdjust = -1;
|
||||||
main_manager()->previousTimeReduction = 1.0;
|
|
||||||
main_manager()->tm.clear();
|
main_manager()->tm.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ void TimeManagement::init(Search::LimitsType& limits,
|
||||||
Color us,
|
Color us,
|
||||||
int ply,
|
int ply,
|
||||||
const OptionsMap& options,
|
const OptionsMap& options,
|
||||||
int& originalPly,
|
|
||||||
double& originalTimeAdjust) {
|
double& originalTimeAdjust) {
|
||||||
TimePoint npmsec = TimePoint(options["nodestime"]);
|
TimePoint npmsec = TimePoint(options["nodestime"]);
|
||||||
|
|
||||||
|
@ -60,9 +59,6 @@ void TimeManagement::init(Search::LimitsType& limits,
|
||||||
if (limits.time[us] == 0)
|
if (limits.time[us] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (originalPly == -1)
|
|
||||||
originalPly = ply;
|
|
||||||
|
|
||||||
TimePoint moveOverhead = TimePoint(options["Move Overhead"]);
|
TimePoint moveOverhead = TimePoint(options["Move Overhead"]);
|
||||||
|
|
||||||
// optScale is a percentage of available time to use for the current move.
|
// optScale is a percentage of available time to use for the current move.
|
||||||
|
@ -104,20 +100,14 @@ void TimeManagement::init(Search::LimitsType& limits,
|
||||||
TimePoint timeLeft = std::max(TimePoint(1), limits.time[us] + limits.inc[us] * (mtg - 1)
|
TimePoint timeLeft = std::max(TimePoint(1), limits.time[us] + limits.inc[us] * (mtg - 1)
|
||||||
- moveOverhead * (2 + mtg));
|
- moveOverhead * (2 + mtg));
|
||||||
|
|
||||||
// Extra time according to timeLeft
|
|
||||||
if (originalTimeAdjust < 0)
|
|
||||||
originalTimeAdjust = 0.2078 + 0.1623 * std::log10(timeLeft);
|
|
||||||
|
|
||||||
// x basetime (+ z increment)
|
// x basetime (+ z increment)
|
||||||
// If there is a healthy increment, timeLeft can exceed the actual available
|
// If there is a healthy increment, timeLeft can exceed the actual available
|
||||||
// game time for the current move, so also cap to a percentage of available game time.
|
// game time for the current move, so also cap to a percentage of available game time.
|
||||||
if (limits.movestogo == 0)
|
if (limits.movestogo == 0)
|
||||||
{
|
{
|
||||||
// Use extra time with larger increments
|
// Extra time according to timeLeft
|
||||||
double optExtra = scaledInc < 500 ? 1.0 : 1.13;
|
if (originalTimeAdjust < 0)
|
||||||
if (ply - originalPly < 2)
|
originalTimeAdjust = 0.3285 * std::log10(timeLeft) - 0.4830;
|
||||||
optExtra *= 0.95;
|
|
||||||
optExtra *= originalTimeAdjust;
|
|
||||||
|
|
||||||
// Calculate time constants based on current time left.
|
// Calculate time constants based on current time left.
|
||||||
double logTimeInSec = std::log10(scaledTime / 1000.0);
|
double logTimeInSec = std::log10(scaledTime / 1000.0);
|
||||||
|
@ -126,7 +116,7 @@ void TimeManagement::init(Search::LimitsType& limits,
|
||||||
|
|
||||||
optScale = std::min(0.0122 + std::pow(ply + 2.95, 0.462) * optConstant,
|
optScale = std::min(0.0122 + std::pow(ply + 2.95, 0.462) * optConstant,
|
||||||
0.213 * limits.time[us] / timeLeft)
|
0.213 * limits.time[us] / timeLeft)
|
||||||
* optExtra;
|
* originalTimeAdjust;
|
||||||
|
|
||||||
maxScale = std::min(6.64, maxConstant + ply / 12.0);
|
maxScale = std::min(6.64, maxConstant + ply / 12.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ class TimeManagement {
|
||||||
Color us,
|
Color us,
|
||||||
int ply,
|
int ply,
|
||||||
const OptionsMap& options,
|
const OptionsMap& options,
|
||||||
int& originalPly,
|
|
||||||
double& originalTimeAdjust);
|
double& originalTimeAdjust);
|
||||||
|
|
||||||
TimePoint optimum() const;
|
TimePoint optimum() const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue