Introduction to Monte Carlo Tree Search
jeffbradberry.com
jeffbradberry.com
I had a go at using UCT to explore a search space earlier this year (not games, but selecting a good sequence of decisions inside a simulation).
The problem I ran into with this approach was that the algorithm has no way to generalise or lift experience from one explored state to other similar / unexplored states, and my search space was large. So having to evaluate each state at least once was prohibitive.
This isn't really a criticism of how well UCT can tackle the problem as framed, but more a criticism of how much better one might be able to do with a bit more structure -- e.g. perhaps with the addition of some kind of similarity metric between states, along with some bounds or assumptions on how the values of "similar" states should relate to each other.
It seems like combining some machine learning / statistical / approximation techniques to approximate the true state->value function with a UCT-like approach to guide exploration could be very effective for the right problem, but getting it to work well might be more of an art than a science.
If anyone has any pointers to reading about this kind of thing, I'd be most grateful! I have previously read about "approximate dynamic programming" techniques, e.g. [1]
[1] http://castlelab.princeton.edu/Papers/Powell-NRLWhat%20you%2...
This uses a deep convolutional NN as an approximation function of the expected value. Interestingly there are only 3 hidden layers in this CNN, and it only gets fed the last 4 frames as state. Of course normally you would feed your approximator a direct encoding of the state. If you wanted to use a NN to evaluate nodes in gametree search you would have to invent some other way to train it. Would love to know whether there is research on that.
Aside from estimating the value of a node from similar nodes, another option is to reduce the search space by putting them in the same information set. This means that to one player they appear indistinguishable, so the same strategy is played in all of them, while the other players might still be able to distinguish them. If your game has a huge state space it's likely that some of the state just hardly matters some of the time to some of the opponents. Other methods of fusing states have the disadvantage that all players have to care about the same information.
To implement MCTS with information sets, use the Information Set MCTS algorithm (ISMCTS) [1], which is a pretty obvious and intuitive extension of MCTS. (Has nobody really described ISMCTS before?) Whitehouse's PhD thesis [2] goes into more detail, and looks at using ISMCTS to reduce the search space in games ("ICARUS"), though I didn't read that chapter. (Earlier this year I mostly-implemented ISMCTS for Cordial Minuet, a game with simultaneous moves in addition to imperfect information. Information sets are unavoidable in simultaneous-move games.)
Also, you will find loads of papers specifically discussing speeding up MCTS for Go, many of which generalise.
[1] http://eprints.whiterose.ac.uk/75048/1/CowlingPowleyWhitehou... [2] http://etheses.whiterose.ac.uk/8117/
These diagrams were supposed to just be an update of the diagrams from the MCTS Wikipedia article, adding the correct backpropagation values, but I see there are more problems than that.
But it is not so easy to know about this, e.g. this is a very recent change to wikipedia page on the topic https://en.wikipedia.org/w/index.php?title=Monte_Carlo_tree_... and very often people writing on the topic are not pointing this out at all, which I find very strange and misleading.
Also in the classic MCTS you should select move which has most visits, not the one with the highest percentage of wins.
* The choice of action to be returned is the one "with the highest average observed long-term reward"
* For simplicity, the payout value used in the paper is 1=win and 0=loss, which will result in the agents maximizing their wins. Presumably one could choose other payout values (i.e. points for that player in games that have that concept) to adjust the priority of the agents. The mathematics does not seem to forbid it.
* This paper uses as their first experiment a multi-player game. They state, "...for P-games UCT is modified to a negamax-style: In MIN nodes the negative of estimated action-values is used in the action selection procedures." It is straightforward and more generalizable to games with N > 2 players to simply record values from that player's standpoint in the first place, instead of manipulating it after the fact in this manner.
I hope this clarifies some things.
I think this is kind of a clear statement that original paper (and after it a lot of writing on the topic) may be lacking. Of course people used this simple generalization before and it is pretty straightforward, but it is not that obvious at a first glance. And I've seen quite a lot of code examples, images explaining UCT for games and articles that were just not saying a word on this. Or even worse - just doing it wrong for multiplayer games.
Choice of action is a different topic, as I remember correctly there was also a paper proving that win rate and most robust branch are in the end performing the same ;)
Hope you will continue this series, because it is really good and code examples are really nice!
http://graphics.stanford.edu/papers/gkdtrees/gkdtrees.pdf
Instead of doing a brute force nearest neighbor search, samples are propagated through a tree.
This technique is exotic, but not new.