mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03: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:
parent
4c081e0479
commit
5f13a87ce7
Notes:
sideshowbarker
2024-07-17 08:03:37 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/5f13a87ce7 Pull-request: https://github.com/SerenityOS/serenity/pull/14855 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/petelliott ✅
@ -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) {
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
// While static parameters are less configurable, they don't take up any
|
||||
// memory in the tree, which I believe to be a worthy tradeoff.
|
||||
static constexpr double s_exploration_parameter { M_SQRT2 };
|
||||
static constexpr int s_number_of_visit_parameter { 1 };
|
||||
// FIXME: Optimize simulations enough for use.
|
||||
static constexpr EvalMethod s_eval_method { EvalMethod::Heuristic };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user