Questions tagged [monte-carlo-tree-search]

Monte-Carlo Tree Search is a best-first, rollout-based tree search algorithm. It gradually improves its evaluations of nodes in the trees using (semi-)random rollouts through those nodes, focusing a larger proportion of rollouts on the parts of the tree that are the most promising. This tag should be used for questions about implementation of this algorithm.

Monte-Carlo Tree Search (MCTS) is a best-first tree search algorithm. "Best-first" means that it focuses the majority of the search effort on the most promising parts of a search tree. This is a popular algorithm for automated game-playing in Artificial Intelligence (AI), but also has applications outside of AI.

For an introduction into the types of search trees that MCTS is typically used for, see minimax.

Older algorithms, such as minimax and alpha-beta-pruning, evaluate a node by systematically searching all the nodes below it, which can be very computationally expensive. The basic idea of MCTS is to rapidly approximate such systematic evaluations of nodes by using (semi-)random rollouts and averaging the evaluations at the end of those rollouts. Over time, the algorithm will focus a larger amount of search effort on parts of the search tree that appear promising based on the earlier rollouts. This enables the algorithm to gradually improve the approximations of the evaluations in those parts of the tree. Additionally, the algorithm gradually grows a tree by storing a number (typically 1) of nodes in memory for every rollout. The parts of the tree that are stored in memory are not traversed using a (semi-)random strategy, but using a different ("Selection") strategy. This guarantees that, given an infinite amount of computation time, the algorithm converges to optimal solutions.

An extensive survey, describing many enhancements and applications of the algorithm, can be found in:

  • Browne, C., Powley, E., Whitehouse, D., Lucas, S., Cowling, P. I., Rohlfshagen, P., Tavener, S., Perez, D., Samothrakis, S., and Colton, S. (2012). A Survey of Monte Carlo Tree Search Methods. Computation Intelligence and AI in Games, IEEE Transactions on, Vol. 4, No. 1, pp. 1-43.

The algorithm was originally proposed in:

  • Kocsis, L. and Szepesvári, C. (2006). Bandit Based Monte-Carlo Planning. Proceedings of the 17th European Conference on Machine Learning (ECML 2006) (eds. J. Fürnkranz, T. Scheffer, and M. Spiliopoulou), Vol. 4212 of Lecture Notes in Computer Science, pp. 282-293, Springer Berlin Heidelberg.
  • Coulom, R. (2007). Efficient Selectivity and Backup Operators in Monte-Carlo Tree Search. Computers and Games (eds. H. J. van den Herik, P. Ciancarini, and H. H. L. M. Donkers), Vol. 4630 of Lecture Notes in Computer Science, pp. 72-83, Springer Berlin Heidelberg.
79 questions
0
votes
0 answers

Monte Carlo tree search keeps giving the same result

I wrote a Monte Carlo tree search algorithm (based on https://en.wikipedia.org/wiki/Monte_Carlo_tree_search), and connected it with the "python-chess" library. Basically, the algorithm gets stuck somewhere, because it keeps printing as output…
0
votes
1 answer

Is it possible to "interrupt" a recursive function and continue it later?

I have a function some_result = treesearch(node) (a variant of Monte-Carlo Tree Search) that recursively searches a large tree. It decides the order in which to traverse the tree via next_node = expensive_heuristic(node) and then propagates the…
FirefoxMetzger
  • 2,880
  • 1
  • 18
  • 32
0
votes
1 answer

Vector attributes on class instance in returned pointer attribute disappearing

I'm implementing a kind of tree search that requires being able to get a "most promising node" from a tree and then doing something with that node in order to update the remainder of the tree for the next iteration. Problem: an object pointer Board*…
magikarp
  • 21
  • 2
0
votes
0 answers

Is it possible to make the nodes and tress of MCTS work on GPU-only with PyTorch?

I've viewed some discussion about MCTS and GPU. It's said there's no advantage using GPU, as it doesn't have many matrix-multiply. But it does have a drawback using CPU, as the data transfering between devices really takes time. Here I mean the…
MarkIc
  • 13
  • 3
0
votes
0 answers

Monte Carlo Tree Search random choices

My IS-MCTS implementation chooses always to go allin and i dont know why. Maybe you guys can help me? Ive already tried to change the saved value in the node from wins to value, which means the earned chip amount, but got bad results too. The…
maronjan
  • 11
  • 4
0
votes
1 answer

Should the Monte Carlo tree in calculating the previous bestMove be used to feed the next Monte Carlo search?

I have seen some MCTS implementation online and how they are used in a game. A best move is calculated each move based on the state at that moment. If you have a sequence of moves in a game between human and computer…
user2120188
  • 427
  • 1
  • 4
  • 16
0
votes
0 answers

Why would alpha zero not run out of memory

After having read through the Deep Mind's Alpha Zero paper, I understood that we are building up a tree and adding a new node to the tree every time we see a new node. For a game like GO (or even CHESS) with such huge state spaces, and such a large…
0
votes
1 answer

What is Monte Carlo Beam Search in neural networks?

Monte Carlo Beam Search is often referenced in neural network and reinforcement learning research. What is it and how is it different than Monte Carlo search.
Justin Shenk
  • 538
  • 1
  • 4
  • 17
0
votes
0 answers

How Leela Zero (new chess engine) works?

Is there a simple explanation for dummies like me? I know that there's a source code of Leela, I've heard that it uses neural networks with MCTS (plus UCT), but there are lot of hard things remaining. Do I need to train Leela myself by running it?…
0
votes
0 answers

Monte Carlo Tree Search for games with randomized card shuffling

I'm trying to look into programming an AI for the game Ticket to Ride. I'm relatively new to artificial intelligence programming so I'll need some help planning out my MCTS implementation. Unlike many non-probabilistic games such as Tic Tac Toe or…
0
votes
0 answers

How to represent repeating patterns in data

I've a homework assignment that uses MCTS (http://mcts.ai/code/python.html) to play as many games of tic tac toe as required using MCTS. The goal of the assignment is to train a decision tree classifier that can predict what the best action is to…
0
votes
1 answer

Tree search based Game AI: How to avoid AI 'wandering'/'procrastination' with sparse rewards?

My game AI makes use of an algorithm that searches all possible future states based on the moves I can make (minimax / monte carlo esque). It evaluates these states using a scoring system, picks the highest scored final state and follows it. This…
0
votes
0 answers

Monte Carlo Algorithm for binary trees don't start rightly

I tried to apply the Monte Carlo algorithm to binary trees, but I have the impression that there is an error in the algorithm because it returns my default value. Here is the structure of the tree in a graphic way: 10 / \ …
Alice Antoine
  • 411
  • 6
  • 17
0
votes
0 answers

Unity struct variable of type struct array initializing

I'm having an issue with my struct. I'm working on an implementation of the Monte Carlo Tree Search algorithm and I created a struct called Node which has specific variables. Now I need to store parent as well as child objects of type node. Since a…
0
votes
1 answer

Monte Carlo Tree Search Alternating

Could anybody please clarify how (as I have not found any clear example anywhere) The MCTS algorithm iterates for the second player. Everything I seem just seems to look like it is playing eg P1 move every time. I understand the steps for one agent…