Skip to content

Commit

Permalink
Add auxengine-options.
Browse files Browse the repository at this point in the history
  • Loading branch information
killerducky committed Feb 17, 2019
1 parent 2628fdb commit 01c6cf6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/mcts/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ const OptionId SearchParams::kAuxEngineDepthId{
const OptionId SearchParams::kAuxEngineBoostId{
"auxengine-boost", "AuxEngineBoost",
"How much to boost Policy, in percentage"};
const OptionId SearchParams::kAuxEngineOptionsId{
"auxengine-options", "AuxEngineOptions",
"Semicolon separated list of UCI options for the auxiliary engine\n"
"e.g. 'Hash value 1024;Threads value 4'"};

void SearchParams::Populate(OptionsParser* options) {
// Here the uci optimized defaults" are set.
Expand Down Expand Up @@ -224,6 +228,7 @@ void SearchParams::Populate(OptionsParser* options) {
options->Add<IntOption>(kAuxEngineThresholdId, 1, 1000000) = 100;
options->Add<IntOption>(kAuxEngineDepthId, 1, 100) = 20;
options->Add<FloatOption>(kAuxEngineBoostId, 0.0f, 1000.0f) = 50.0f;
options->Add<StringOption>(kAuxEngineOptionsId);
}

SearchParams::SearchParams(const OptionsDict& options)
Expand Down
4 changes: 4 additions & 0 deletions src/mcts/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class SearchParams {
float GetAuxEngineBoost() const {
return options_.Get<float>(kAuxEngineBoostId.GetId());
}
std::string GetAuxEngineOptions() const {
return options_.Get<std::string>(kAuxEngineOptionsId.GetId());
}

// Search parameter IDs.
static const OptionId kMiniBatchSizeId;
Expand Down Expand Up @@ -141,6 +144,7 @@ class SearchParams {
static const OptionId kAuxEngineThresholdId;
static const OptionId kAuxEngineDepthId;
static const OptionId kAuxEngineBoostId;
static const OptionId kAuxEngineOptionsId;

private:
const OptionsDict& options_;
Expand Down
11 changes: 8 additions & 3 deletions src/mcts/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,14 @@ void Search::OpenAuxEngine() {
LOGFILE << "aolsen " << path;
if (!auxengine_ready_) {
auxengine_c_ = boost::process::child(path, boost::process::std_in < auxengine_os_, boost::process::std_out > auxengine_is_);
// magic setting SF specific stuff
auxengine_os_ << "setoption name Hash value 1024" << std::endl;
auxengine_os_ << "uci" << std::endl;
{
std::istringstream iss(params_.GetAuxEngineOptions());
std::string token;
while(std::getline(iss, token, ';')) {
auxengine_os_ << "setoption name " << token << std::endl;
}
auxengine_os_ << "uci" << std::endl;
}
std::string line;
while(std::getline(auxengine_is_, line)) {
LOGFILE << "aolsen auxengine:" << line;
Expand Down

0 comments on commit 01c6cf6

Please sign in to comment.