Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup TimeManagement - Unnecessarily min,max & clamp executions everytime #5052

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6eb9479
change the time management time cap to 10%
TierynnB Feb 6, 2024
83c406e
moved optimumExtra to within moved to go = 0. Could improve performance
TierynnB Feb 13, 2024
b6aac09
Merge branch 'official-stockfish:master' into branch_1
TierynnB Feb 13, 2024
ba1f6f1
delete vscode settingjson
TierynnB Feb 14, 2024
8ef07d6
move more logic into if movestogo ==0
TierynnB Feb 14, 2024
66e98a0
non-functional cleanup
TierynnB Feb 14, 2024
8894b29
formatted
TierynnB Feb 14, 2024
3db497c
Assorted trivial cleanups
FauziAkram Feb 4, 2024
c18e425
Refactor the CI workflows
Disservin Feb 9, 2024
64557a4
Tweak capture scoring for move ordering
locutus2 Feb 1, 2024
65b9ba4
Remove simple eval
cj5716 Feb 6, 2024
523e333
Simplify opponent movecount reduction
gahtan-syarif Feb 7, 2024
fa89352
Remove check extension
XInTheDark Feb 7, 2024
eedb8d1
Fix the alignment of the transformer buffer
mstembera Feb 8, 2024
21cce50
Update CI actions
Disservin Feb 10, 2024
604cfe4
Remove unnecessary assignments related to adjusted static evaluation
GoldenRare Feb 6, 2024
a5e6575
Assorted cleanups
Disservin Feb 10, 2024
4662d8c
Adjust best value in main search depending on depth
Vizvezdenec Feb 10, 2024
1e02356
Improve thread voting inefficiencies
mstembera Feb 10, 2024
482015a
Remove quiet tt move extensions
gahtan-syarif Feb 9, 2024
0e303d2
Format code using clang-format
Disservin Feb 11, 2024
f94f387
delete vscode settingjson
TierynnB Feb 14, 2024
ca9abb2
move more logic into if movestogo ==0
TierynnB Feb 14, 2024
01deb8e
non-functional cleanup
TierynnB Feb 14, 2024
c130fe2
formatted
TierynnB Feb 14, 2024
800a29e
Merge branch 'branch_1' of https://github.com/TierynnB/Stockfish into…
TierynnB Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ VPATH = syzygy:nnue:nnue/features
# Note that Makefile is space sensitive, so when adding new architectures
# or modifying existing flags, you have to make sure there are no extra spaces
# at the end of the line for flag values.
#
#
# Example of use for these flags:
# make build ARCH=x86-64-avx512 debug=yes sanitize="address undefined"

Expand Down
16 changes: 8 additions & 8 deletions src/timeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

namespace Stockfish {


TimePoint TimeManagement::optimum() const { return optimumTime; }
TimePoint TimeManagement::maximum() const { return maximumTime; }
TimePoint TimeManagement::elapsed(size_t nodes) const {
Expand Down Expand Up @@ -89,18 +88,19 @@ void TimeManagement::init(Search::LimitsType& limits,
TimePoint timeLeft = std::max(TimePoint(1), limits.time[us] + limits.inc[us] * (mtg - 1)
- moveOverhead * (2 + mtg));

// Use extra time with larger increments
double optExtra = std::clamp(1.0 + 12.5 * limits.inc[us] / limits.time[us], 1.0, 1.11);

// Calculate time constants based on current time left.
double optConstant = std::min(0.00334 + 0.0003 * std::log10(limits.time[us] / 1000.0), 0.0049);
double maxConstant = std::max(3.4 + 3.0 * std::log10(limits.time[us] / 1000.0), 2.76);

// x basetime (+ z increment)
// If there is a healthy increment, timeLeft can exceed actual available
// game time for the current move, so also cap to 20% of available game time.
if (limits.movestogo == 0)
{
// Use extra time with larger increments
double optExtra = std::clamp(1.0 + 12.5 * limits.inc[us] / limits.time[us], 1.0, 1.11);

// Calculate time constants based on current time left.
double optConstant =
std::min(0.00334 + 0.0003 * std::log10(limits.time[us] / 1000.0), 0.0049);
double maxConstant = std::max(3.4 + 3.0 * std::log10(limits.time[us] / 1000.0), 2.76);

optScale = std::min(0.0120 + std::pow(ply + 3.1, 0.44) * optConstant,
0.21 * limits.time[us] / double(timeLeft))
* optExtra;
Expand Down
Loading