/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
- Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
- Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
- Copyright (C) 2015-2020 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
+ Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
using std::string;
+namespace Stockfish {
+
bool Tune::update_on_last;
const UCI::Option* LastOption = nullptr;
-BoolConditions Conditions;
static std::map<std::string, int> TuneResults;
string Tune::next(string& names, bool pop) {
Options[n] << UCI::Option(v, r(v).first, r(v).second, on_tune);
LastOption = &Options[n];
- // Print formatted parameters, ready to be copy-pasted in fishtest
+ // Print formatted parameters, ready to be copy-pasted in Fishtest
std::cout << n << ","
<< v << ","
<< r(v).first << "," << r(v).second << ","
template<> void Tune::Entry<int>::read_option() {
if (Options.count(name))
- value = Options[name];
+ value = int(Options[name]);
}
template<> void Tune::Entry<Value>::init_option() { make_option(name, value, range); }
template<> void Tune::Entry<Score>::read_option() {
if (Options.count("m" + name))
- value = make_score(Options["m" + name], eg_value(value));
+ value = make_score(int(Options["m" + name]), eg_value(value));
if (Options.count("e" + name))
- value = make_score(mg_value(value), Options["e" + name]);
+ value = make_score(mg_value(value), int(Options["e" + name]));
}
// Instead of a variable here we have a PostUpdate function: just call it
template<> void Tune::Entry<Tune::PostUpdate>::init_option() {}
template<> void Tune::Entry<Tune::PostUpdate>::read_option() { value(); }
-
-// Set binary conditions according to a probability that depends
-// on the corresponding parameter value.
-
-void BoolConditions::set() {
-
- static PRNG rng(now());
- static bool startup = true; // To workaround fishtest bench
-
- for (size_t i = 0; i < binary.size(); i++)
- binary[i] = !startup && (values[i] + int(rng.rand<unsigned>() % variance) > threshold);
-
- startup = false;
-
- for (size_t i = 0; i < binary.size(); i++)
- sync_cout << binary[i] << sync_endl;
-}
+} // namespace Stockfish
// Init options with tuning session results instead of default values. Useful to
#include <cmath>
+namespace Stockfish {
+
void Tune::read_results() {
/* ...insert your values here... */
}
+
+} // namespace Stockfish