1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

ChessEngine: Limit MCTSTree expansion

This method temperate the habit of Monte-Carlo based algorithms to
repeatedly create new nodes.

It was first implemented in `Efficient Selectivity and Backup Operators
in Monte-Carlo Tree Search` by Rémi Coulom.
This commit is contained in:
Lucas CHOLLET 2022-08-14 13:09:00 +02:00 committed by Andreas Kling
parent 4c081e0479
commit 5f13a87ce7
2 changed files with 10 additions and 1 deletions

View file

@ -98,7 +98,15 @@ void MCTSTree::apply_result(int game_score)
void MCTSTree::do_round()
{
auto& node = select_leaf().expand();
// Note: Limit expansion to spare some memory
// Efficient Selectivity and Backup Operators in Monte-Carlo Tree Search.
// Rémi Coulom.
auto* node_ptr = &select_leaf();
if (node_ptr->m_simulations > s_number_of_visit_parameter)
node_ptr = &select_leaf().expand();
auto& node = *node_ptr;
int result;
if constexpr (s_eval_method == EvalMethod::Simulation) {