mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Revert "Implement a fallback system when aspiration search fails low and we are out of time."
This reverts commit 55dd98f7c717b94a659931cd20e088334b1cf7a6. Revert fallback-system for root_search Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
committed by
Marco Costalba
parent
0ea716463b
commit
3e7e1a7c53
@@ -259,7 +259,7 @@ namespace {
|
|||||||
// Time managment variables
|
// Time managment variables
|
||||||
int SearchStartTime;
|
int SearchStartTime;
|
||||||
int MaxNodes, MaxDepth;
|
int MaxNodes, MaxDepth;
|
||||||
int MaxSearchTime, AbsoluteMaxSearchTime, EmergencyMaxSearchTime, ExtraSearchTime;
|
int MaxSearchTime, AbsoluteMaxSearchTime, ExtraSearchTime;
|
||||||
Move EasyMove;
|
Move EasyMove;
|
||||||
int RootMoveNumber;
|
int RootMoveNumber;
|
||||||
bool InfiniteSearch;
|
bool InfiniteSearch;
|
||||||
@@ -520,11 +520,9 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
|
|||||||
{
|
{
|
||||||
MaxSearchTime = myTime / 30 + myIncrement;
|
MaxSearchTime = myTime / 30 + myIncrement;
|
||||||
AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100);
|
AbsoluteMaxSearchTime = Max(myTime / 4, myIncrement - 100);
|
||||||
EmergencyMaxSearchTime = Max(myTime / 2, myIncrement - 100);
|
|
||||||
} else { // Blitz game without increment
|
} else { // Blitz game without increment
|
||||||
MaxSearchTime = myTime / 30;
|
MaxSearchTime = myTime / 30;
|
||||||
AbsoluteMaxSearchTime = myTime / 8;
|
AbsoluteMaxSearchTime = myTime / 8;
|
||||||
EmergencyMaxSearchTime = myTime / 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // (x moves) / (y minutes)
|
else // (x moves) / (y minutes)
|
||||||
@@ -533,11 +531,9 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
|
|||||||
{
|
{
|
||||||
MaxSearchTime = myTime / 2;
|
MaxSearchTime = myTime / 2;
|
||||||
AbsoluteMaxSearchTime = Min(myTime / 2, myTime - 500);
|
AbsoluteMaxSearchTime = Min(myTime / 2, myTime - 500);
|
||||||
EmergencyMaxSearchTime = myTime - 500;
|
|
||||||
} else {
|
} else {
|
||||||
MaxSearchTime = myTime / Min(movesToGo, 20);
|
MaxSearchTime = myTime / Min(movesToGo, 20);
|
||||||
AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3);
|
AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3);
|
||||||
EmergencyMaxSearchTime = Min((8 * myTime) / movesToGo, myTime / 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,9 +700,6 @@ namespace {
|
|||||||
Position p(pos);
|
Position p(pos);
|
||||||
SearchStack ss[PLY_MAX_PLUS_2];
|
SearchStack ss[PLY_MAX_PLUS_2];
|
||||||
|
|
||||||
Value alpha;
|
|
||||||
Value beta;
|
|
||||||
|
|
||||||
// searchMoves are verified, copied, scored and sorted
|
// searchMoves are verified, copied, scored and sorted
|
||||||
RootMoveList rml(p, searchMoves);
|
RootMoveList rml(p, searchMoves);
|
||||||
|
|
||||||
@@ -736,6 +729,9 @@ namespace {
|
|||||||
std::cout << "info depth " << Iteration << std::endl;
|
std::cout << "info depth " << Iteration << std::endl;
|
||||||
|
|
||||||
//Calculate dynamic search window based on previous iterations.
|
//Calculate dynamic search window based on previous iterations.
|
||||||
|
Value alpha;
|
||||||
|
Value beta;
|
||||||
|
|
||||||
if (MultiPV == 1 && Iteration >= 6) {
|
if (MultiPV == 1 && Iteration >= 6) {
|
||||||
Value prevDelta1 = IterationInfo[Iteration - 1].speculated_value() - IterationInfo[Iteration - 2].speculated_value();
|
Value prevDelta1 = IterationInfo[Iteration - 1].speculated_value() - IterationInfo[Iteration - 2].speculated_value();
|
||||||
Value prevDelta2 = IterationInfo[Iteration - 2].speculated_value() - IterationInfo[Iteration - 3].speculated_value();
|
Value prevDelta2 = IterationInfo[Iteration - 2].speculated_value() - IterationInfo[Iteration - 3].speculated_value();
|
||||||
@@ -754,14 +750,13 @@ namespace {
|
|||||||
|
|
||||||
// Search to the current depth
|
// Search to the current depth
|
||||||
Value value = root_search(p, ss, rml, alpha, beta);
|
Value value = root_search(p, ss, rml, alpha, beta);
|
||||||
|
if (AbortSearch)
|
||||||
|
break; //Value cannot be trusted. Break out immediately!
|
||||||
|
|
||||||
// Write PV to transposition table, in case the relevant entries have
|
// Write PV to transposition table, in case the relevant entries have
|
||||||
// been overwritten during the search:
|
// been overwritten during the search:
|
||||||
TT.insert_pv(p, ss[0].pv);
|
TT.insert_pv(p, ss[0].pv);
|
||||||
|
|
||||||
if (AbortSearch)
|
|
||||||
break; //Value cannot be trusted. Break out immediately!
|
|
||||||
|
|
||||||
//Save info about search result
|
//Save info about search result
|
||||||
Value speculated_value = value;
|
Value speculated_value = value;
|
||||||
bool fHigh = false;
|
bool fHigh = false;
|
||||||
@@ -831,6 +826,7 @@ namespace {
|
|||||||
|
|
||||||
if (stopSearch)
|
if (stopSearch)
|
||||||
{
|
{
|
||||||
|
//FIXME: Implement fail-low emergency measures
|
||||||
if (!PonderSearch)
|
if (!PonderSearch)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@@ -842,34 +838,6 @@ namespace {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FailLow)
|
|
||||||
{
|
|
||||||
//Here we face the rare, but extremely difficult case:
|
|
||||||
//Our aspiration search has failed low and we've run out of time!
|
|
||||||
//So we have no move to play!
|
|
||||||
//Now use the emergency time and try as quickly as possible to
|
|
||||||
//find even one playable move.
|
|
||||||
|
|
||||||
//FIXME: this is only for grepping logs purpose. Remove me when we are sure that this stuff really works!!
|
|
||||||
if (AbortSearch)
|
|
||||||
std::cout << "info depth " << 999 << std::endl;
|
|
||||||
else
|
|
||||||
std::cout << "info depth " << 998 << std::endl;
|
|
||||||
|
|
||||||
//Prepare variables for emergency search
|
|
||||||
AbortSearch = false;
|
|
||||||
FailLow = false;
|
|
||||||
AbsoluteMaxSearchTime = EmergencyMaxSearchTime;
|
|
||||||
MaxSearchTime = EmergencyMaxSearchTime;
|
|
||||||
ExtraSearchTime = 0;
|
|
||||||
rml.sort();
|
|
||||||
|
|
||||||
std::cout << "info depth " << Iteration << std::endl;
|
|
||||||
|
|
||||||
//Cause we failed low, it's _likely_ that we couldn't get over alpha anyway.
|
|
||||||
root_search(p, ss, rml, -VALUE_INFINITE, alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
rml.sort();
|
rml.sort();
|
||||||
|
|
||||||
// If we are pondering, we shouldn't print the best move before we
|
// If we are pondering, we shouldn't print the best move before we
|
||||||
@@ -923,6 +891,7 @@ namespace {
|
|||||||
|
|
||||||
Value root_search(Position &pos, SearchStack ss[], RootMoveList &rml, Value alpha, Value beta) {
|
Value root_search(Position &pos, SearchStack ss[], RootMoveList &rml, Value alpha, Value beta) {
|
||||||
|
|
||||||
|
//FIXME: Implement bestValue
|
||||||
Value oldAlpha = alpha;
|
Value oldAlpha = alpha;
|
||||||
Value value;
|
Value value;
|
||||||
Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
|
Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
|
||||||
|
|||||||
Reference in New Issue
Block a user