-
Notifications
You must be signed in to change notification settings - Fork 298
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
Add searchmoves functionality #677
base: next
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -382,4 +382,4 @@ void NodeTree::DeallocateTree() { | |
current_head_ = nullptr; | ||
} | ||
|
||
} // namespace lczero | ||
} // namespace lczero |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -641,6 +641,8 @@ Node* Search::PickNodeToExtend(Node* node, PositionHistory* history) { | |
? -node->GetQ(0, kExtraVirtualLoss) | ||
: -node->GetQ(0, kExtraVirtualLoss) - | ||
kFpuReduction * std::sqrt(node->GetVisitedPolicy()); | ||
|
||
bool root_color = played_history_.IsBlackToMove(); | ||
for (Node* iter : node->Children()) { | ||
if (is_root_node) { | ||
// If there's no chance to catch up the currently best node with | ||
|
@@ -652,6 +654,14 @@ Node* Search::PickNodeToExtend(Node* node, PositionHistory* history) { | |
remaining_playouts_ < best_node_n - iter->GetNStarted()) { | ||
continue; | ||
} | ||
// If searchmoves was sent, restrict the search only in that moves | ||
if (!limits_.searchmoves.empty() && | ||
std::find(limits_.searchmoves.begin(), | ||
limits_.searchmoves.end(), | ||
iter->GetMove(root_color).as_string()) == | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to do vice versa, convert searchmoves from string to Move (somewhere before getting into Search class) and then compare. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
limits_.searchmoves.end()) { | ||
continue; | ||
} | ||
++possible_moves; | ||
} | ||
float Q = iter->GetQ(parent_q, kExtraVirtualLoss); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, will return back.