7 Monte Carlo Tree Search: Searching with Reinforcement Learning Principles
Monte Carlo Tree Search is presented as a practical way to reason through complex sequential decisions by building and searching a tree of possible futures. The chapter starts with the idea that many real business problems, especially routing and planning tasks, naturally form branching decision structures: each choice creates new downstream possibilities, and trees provide a clear way to model those options. A simple routing example is used to show how nodes, branches, and leaf outcomes can represent operational states, candidate actions, and final costs, setting the stage for more intelligent search methods.
The chapter then explains why basic tree search methods are useful but limited. Breadth-first search systematically checks shallow possibilities first and can find short solutions, but it becomes memory-heavy and expensive as the number of routes grows. Depth-first search is more memory-efficient and dives deeply into one branch, but it can miss better alternatives and still struggles with large spaces. These limitations motivate Monte Carlo Tree Search, which avoids exhaustive enumeration by selectively exploring promising branches, using a balance of exploration and exploitation rather than trying every option equally.
MCTS is then developed as a four-step loop: selection, expansion, simulation, and backpropagation. Selection uses UCB1 to choose branches that either perform well or remain underexplored, expansion adds one new child at a time, simulation completes partial solutions with a rollout policy, and backpropagation updates visit counts and rewards along the path. The chapter applies this framework to the capacitated vehicle routing problem, showing how problem state, feasible actions, route cost, and local improvement can all be encoded in code. The result is a hybrid optimizer that combines global search with local refinement, producing strong practical solutions without needing to examine every possible route.
Tree data structure in vehicle route planning problem
Breadth-First Search (BFS) algorithm and flow.
Depth-First Search (DFS) algorithm and flow.
The four-phase cycle of Monte Carlo Tree Search.
UCB1 algorithm for node selection in MCTS.
Capacitated Vehicle Routing Problem (CVRP) schema.
Results of running MCTS for CVRP problem.
Summary
- Trees are hierarchical data structures where each node connects to children through parent-child relationships.
- A tree is, mathematically, a connected, directed acyclic graph with no loops, ensuring a unique path exists from root to any node.
- Breadth-First Search (BFS) explores trees level by level using a FIFO queue, guaranteeing the shortest path but consuming significant memory.
- Depth-First Search (DFS) explores one branch completely before backtracking using a LIFO stack (often implemented via recursion), using less memory but not guaranteeing shortest paths.
- Both BFS and DFS struggle with exponential growth in routing problems—with 10 customers there are 3.6 million possible routes, making exhaustive search infeasible.
- MCTS intelligently balances exploration (trying new branches) and exploitation (focusing on promising paths) rather than exhaustively searching every possibility.
- MCTS blends sampling from Monte Carlo simulation, state-action-value structure from MDPs, planning discipline from dynamic programming, and incremental updates from temporal-difference learning.
- MCTS operates in four phases iteratively: Selection (navigate tree), Expansion (add new node), Simulation (complete solution), and Backpropagation (update statistics).
- Selection navigates down the tree using UCB1 at each level until reaching a node with unexplored actions or a terminal state.
- Expansion adds one new child node per iteration by trying an untried action, building the tree incrementally guided by selection.
- Simulation completes a partial solution from the expanded node using a rollout policy (often random or greedy), providing an outcome estimate without perfect planning.
- Backpropagation walks from the expanded node to root, updating visit counts and total rewards at each node along the path, enabling statistical learning.
- Modern practitioners don't dogmatically choose one paradigm but understand when each fits and how to combine them, as MCTS itself demonstrates by synthesizing multiple approaches.
- MCTS represents pragmatic reinforcement learning—embracing both computational power and limitations, using intelligent exploration with simulation-based evaluation to find high-quality solutions in reasonable time.
Applied Reinforcement Learning ebook for free