|
io-chess
UCI chess engine
|
Handles adaptive time allocation during search. More...
#include <TimeManager.h>

Classes | |
| struct | TimeAllocation |
| Recommended time limits for the current move. More... | |
| struct | Config |
| Tunable configuration for time management heuristics. More... | |
Public Types | |
| enum class | TimeControl { BULLET , BLITZ , RAPID , CLASSICAL , CORRESPONDENCE } |
| Categorization of time controls based on base time. More... | |
Public Member Functions | |
| TimeManager ()=default | |
| TimeManager (const Config &cfg) | |
| TimeAllocation | calculate (const SearchParams ¶ms, chess::Color side, float phase, float evalCp, int moveNumber) const |
| Calculates time allocation for a position. | |
| bool | shouldStop (int64_t elapsed, int depth, int bestMoveChanges, int scoreDrops, const TimeAllocation &allocation) const |
| Checks if search should stop based on elapsed time and stability. | |
| float | getExtensionFactor (int bestMoveChanges, int scoreDrops) const |
| Gets the extension factor based on search instability. | |
| const Config & | config () const |
| void | setConfig (const Config &cfg) |
Private Member Functions | |
| TimeControl | detectTimeControl (int baseTimeMs, int incrementMs) const |
| float | getPhaseMultiplier (float phase) const |
| float | getEvalMultiplier (float evalCp) const |
| float | getControlMultiplier (TimeControl control) const |
| int | estimateMovesRemaining (int moveNumber, float phase, int movestogo) const |
Private Attributes | |
| Config | config_ |
Handles adaptive time allocation during search.
|
strong |
|
default |
|
inlineexplicit |
| TimeManager::TimeAllocation TimeManager::calculate | ( | const SearchParams & | params, |
| chess::Color | side, | ||
| float | phase, | ||
| float | evalCp, | ||
| int | moveNumber ) const |
Calculates time allocation for a position.
| params | Search parameters (time, inc, movestogo, etc.). |
| side | Side to move. |
| phase | Game phase from FeatureExtractor (0.0=opening, 1.0=endgame). |
| evalCp | Current evaluation in centipawns (from previous search). |
| moveNumber | Full move number (1-based). |


|
inline |
|
private |

|
private |

|
private |

|
private |

| float TimeManager::getExtensionFactor | ( | int | bestMoveChanges, |
| int | scoreDrops ) const |
Gets the extension factor based on search instability.
Called during iterative deepening to adjust time limits dynamically.
| bestMoveChanges | Count of root best move changes. |
| scoreDrops | Count of significant score drops. |

|
private |

|
inline |
| bool TimeManager::shouldStop | ( | int64_t | elapsed, |
| int | depth, | ||
| int | bestMoveChanges, | ||
| int | scoreDrops, | ||
| const TimeAllocation & | allocation ) const |
Checks if search should stop based on elapsed time and stability.
| elapsed | Time spent so far (ms). |
| depth | Current search depth. |
| bestMoveChanges | How many times best move changed. |
| scoreDrops | How many times score dropped significantly. |
| allocation | Previously calculated allocation limits. |

|
private |