Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Monte Carlo tree search

Also known as MCTS, UCT, Upper confidence bounds applied to trees

adversarial game-tree-search

Monte Carlo tree search (MCTS) grows a search tree by simulations instead of searching every line to a fixed depth. Each simulation descends from the root, trying unvisited children first and then choosing by a selection rule for the side to move; it adds the first new node it reaches, values it with an evaluator and adds that reward, in [0, 1] from Max's point of view, to every node on its path. The default selection is UCT, a child's mean reward for the side to move plus an exploration bonus that shrinks with its visits; the default evaluator is a random playout, and the game's own evaluation can replace it. After the budget of simulations or nodes, it plays the most visited root move and reports each root move's visits and mean, which several searches, say over sampled deals of hidden cards, can add up. After both sides have moved, the subtree under those moves can be kept, so the next search starts from what the last one learned (tree reuse). It needs no evaluation function and suits games with large branching factors; its strength grows with the simulations spent.

Pseudocode

algorithm MCTS(p₀, budget)input: root position p₀, budget of simulations or nodesoutput: the most visited root move, and each root move's visits and mean rewardT ← tree with the root p₀, expandedwhile not exhausted(budget) dopath ← ⟨root⟩n ← rootwhile n is expanded and has children doif some child of n is unvisited thenn ← first unvisited child              ▷ in move orderexpand(n)append(path, n)breakn ← argmax over children c of score(side(n), n, c)   ▷ ties go to the earliestappend(path, n)if the game ends at n thenr ← reward(evaluate(n))                  ▷ Max's reward in [0, 1]elser ← evaluator(n)                         ▷ random playout, or the static valuefor each node u in path dovisits(u) ← visits(u) + 1value(u) ← value(u) + r                  ▷ mean backupreturn the most visited child of the root, and every root move's visits and meanfunction score(s, n, c)                        ▷ UCTreturn mean(c, s) + C · √(ln visits(n) / visits(c))

In the crates

  • game-tree-search

    MCTS under a simulation or node budget, with replaceable selection (UCT or PUCT), leaf evaluation (random rollout or the static value) and random source; reports visits and values per root move, and keeps the subtree of the moves played for the next search.

    MctsUctRolloutStaticValue

Lineage

Comes from

Nothing on this site.

Led to

Batched MCTS with virtual loss builds on it

Gumbel MCTS builds on it

POMCP builds on it

PUCT specializes it

Root-parallel MCTS builds on it

Papers

  1. Efficient Selectivity and Backup Operators in Monte-Carlo Tree Search Rémi Coulom · 2007· Computers and Games (CG 2006), Lecture Notes in Computer Science introduces doi 10.1007/978-3-540-75538-8_7
  2. Bandit Based Monte-Carlo Planning Levente Kocsis, Csaba Szepesvári · 2006· Machine Learning: ECML 2006, Lecture Notes in Computer Science introduces doi 10.1007/11871842_29
  3. A Survey of Monte Carlo Tree Search Methods Cameron B. Browne, Edward Powley, Daniel Whitehouse, Simon M. Lucas, Peter I. Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, Simon Colton · 2012· IEEE Transactions on Computational Intelligence and AI in Games survey doi 10.1109/TCIAIG.2012.2186810