mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +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:
parent
4c081e0479
commit
5f13a87ce7
2 changed files with 10 additions and 1 deletions
|
@ -98,7 +98,15 @@ void MCTSTree::apply_result(int game_score)
|
||||||
|
|
||||||
void MCTSTree::do_round()
|
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;
|
int result;
|
||||||
if constexpr (s_eval_method == EvalMethod::Simulation) {
|
if constexpr (s_eval_method == EvalMethod::Simulation) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ private:
|
||||||
// While static parameters are less configurable, they don't take up any
|
// While static parameters are less configurable, they don't take up any
|
||||||
// memory in the tree, which I believe to be a worthy tradeoff.
|
// memory in the tree, which I believe to be a worthy tradeoff.
|
||||||
static constexpr double s_exploration_parameter { M_SQRT2 };
|
static constexpr double s_exploration_parameter { M_SQRT2 };
|
||||||
|
static constexpr int s_number_of_visit_parameter { 1 };
|
||||||
// FIXME: Optimize simulations enough for use.
|
// FIXME: Optimize simulations enough for use.
|
||||||
static constexpr EvalMethod s_eval_method { EvalMethod::Heuristic };
|
static constexpr EvalMethod s_eval_method { EvalMethod::Heuristic };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue