1
0
Fork 0

Simplify time management

Tested with simplification mode SPRT[-4, 0]

Passed both short TC
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 34102 W: 6184 L: 6144 D: 21774

And long TC
LLR: 2.96 (-2.94,2.94) [-4.00,0.00]
Total: 16518 W: 2647 L: 2545 D: 11326

And also 40/10 TC
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 22406 W: 4390 L: 4312 D: 13704

bench: 8430785
pull/358/head
Leonid Pechenik 2014-02-11 04:01:06 -05:00 committed by Marco Costalba
parent e6523e56b8
commit 72e8640f4d
4 changed files with 12 additions and 14 deletions

View File

@ -320,7 +320,7 @@ namespace {
while (++depth <= MAX_PLY && !Signals.stop && (!Limits.depth || depth <= Limits.depth))
{
// Age out PV variability metric
BestMoveChanges *= 0.8;
BestMoveChanges *= 0.5;
// Save the last iteration's scores before first PV line is searched and
// all the move scores except the (new) PV are set to -VALUE_INFINITE.
@ -429,11 +429,10 @@ namespace {
if (depth > 4 && depth < 50 && PVSize == 1)
TimeMgr.pv_instability(BestMoveChanges);
// Stop the search if only one legal move is available or most
// of the available time has been used. We probably don't have
// enough time to search the first move at the next iteration anyway.
// Stop the search if only one legal move is available or all
// of the available time has been used.
if ( RootMoves.size() == 1
|| IterationTime > (TimeMgr.available_time() * 62) / 100)
|| IterationTime > TimeMgr.available_time() )
stop = true;
if (stop)
@ -1628,9 +1627,8 @@ void check_time() {
Time::point elapsed = Time::now() - SearchTime;
bool stillAtFirstMove = Signals.firstRootMove
&& !Signals.failedLowAtRoot
&& ( elapsed > TimeMgr.available_time()
|| ( elapsed > (TimeMgr.available_time() * 62) / 100
&& elapsed > IterationTime * 1.4));
&& elapsed > TimeMgr.available_time()
&& elapsed > IterationTime * 1.4;
bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution
|| stillAtFirstMove;

View File

@ -60,7 +60,7 @@ namespace {
void TimeManager::pv_instability(double bestMoveChanges) {
unstablePVExtraTime = int(bestMoveChanges * optimumSearchTime / 1.4);
unstablePvFactor = 1 + bestMoveChanges;
}
@ -90,8 +90,8 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u
int minThinkingTime = Options["Minimum Thinking Time"];
int slowMover = Options["Slow Mover"];
// Initialize all to maximum values but unstablePVExtraTime that is reset
unstablePVExtraTime = 0;
// Initialize unstablePvFactor to 1 and search times to maximum values
unstablePvFactor = 1;
optimumSearchTime = maximumSearchTime = std::max(limits.time[us], minThinkingTime);
// We calculate optimum time usage for different hypothetical "moves to go"-values and choose the

View File

@ -27,13 +27,13 @@ class TimeManager {
public:
void init(const Search::LimitsType& limits, int currentPly, Color us);
void pv_instability(double bestMoveChanges);
int available_time() const { return optimumSearchTime + unstablePVExtraTime; }
int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.62); }
int maximum_time() const { return maximumSearchTime; }
private:
int optimumSearchTime;
int maximumSearchTime;
int unstablePVExtraTime;
double unstablePvFactor;
};
#endif // #ifndef TIMEMAN_H_INCLUDED

View File

@ -83,7 +83,7 @@ void init(OptionsMap& o) {
o["Emergency Base Time"] = Option(60, 0, 30000);
o["Emergency Move Time"] = Option(30, 0, 5000);
o["Minimum Thinking Time"] = Option(20, 0, 5000);
o["Slow Mover"] = Option(70, 10, 1000);
o["Slow Mover"] = Option(80, 10, 1000);
o["UCI_Chess960"] = Option(false);
o["UCI_AnalyseMode"] = Option(false, on_eval);
}