Answers.Body: <blockquote>
  <p>I am having trouble understanding how to keep track of the expansion, do I expand all stochastic possibilities and weight the return via their chance of happening?</p>
  </blockquote>
  <p>This is indeed one option you can take. This would be very similar in spirit to the idea of &quot;Expectimax&quot; as a variant of minimax for non-deterministic games, in the sense that you'll include explicit &quot;chance nodes&quot; in your tree. When running into such a chance node later on again during a Selection phase, of a later MCTS iteration, you can just select a path of the tree to follow based on a &quot;dice roll&quot;. <strong>Importantly</strong>, note that this option is only actually available if you have explicit knowledge of exactly when chance events occur, which states they can lead to, and with which probabilities they lead to different states. We also assume that this is feasible, i.e. that you don't have a crazy high (or infinite) number of slightly different game states you could reach.</p>
  <p>An alternative option is to use an &quot;open-loop&quot; variant of MCTS. Your nodes would no longer represent game states, but only be representative of the sequence of actions leading to them. You would no longer store any game states in any nodes, but always regenerate them from scratch when traversing the tree, starting from the root node. You would no longer have any explicit chance nodes, but instead have states being representative of larger <strong>sets of states</strong> that could possibly be reached by following the corresponding path from the root node. For more on this, see <a href="https://ai.stackexchange.com/a/13919/1641">my answer to this other question</a>. The advantage of this approach is that it does not require explicit knowledge of all the possible states you can reach due to chance events, do not need explicit knowledge of the probabilities, and can just sample instead of explicitly enumerating every possible outcome.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-13T16:14:41.833Z
Answers.LastActivityDate: 2020-08-13T16:14:41.833Z
Answers.UserDisplayName: Dennis Soemers
Body: <p>For MCTS there is an expansion phase where we make a move and list down all the next states. But this is complicated by the fact that for some games, after making the move, there is a stochastic change to the environment. Consider the game 2048, after I make a move, random tile is generated. So the state of the world after my next move is a mix of possibilities!</p>
  <p>How does MCTS work in a stochastic environment? I am having trouble understanding how to keep track of the expansion, do I expand all stochastic possibilities and weight the return via their chance of happening?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-09T00:04:41.997Z
Comments.Text: MCTS has been used for two-player games like Go, so maybe you could consider the random move as simply the move of the opponent.
Comments.UserDisplayName: Varun Vejalla
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-09T03:37:27.040Z
Comments.Text: That is something I don't understand. In Go the player can have hundreds of different responses but you can use a metric to choose a branch (essentially, assuming your opponent plays optimally, but u r guess optimality with a heuristic). with random play you don't know which move will be played so you have to track through all possible moves.
Comments.UserDisplayName: xiaodai
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-09T04:08:48.523Z
Comments.Text: Yeah, I see your point. Maybe you could use random sequences (which are fixed for each tree search) of new tile positions? Of course, you would run into the complication of a new tile overlapping an existing tile in some iterations, so some way of countering that would need to be put in place.
Comments.UserDisplayName: Varun Vejalla
Tags: <monte-carlo-tree-search>
Title: How to run a Monte Carlo Tree Search MCTS for stochastic environment?
UserDisplayName: xiaodai
ThreadText: # How to run a Monte Carlo Tree Search MCTS for stochastic environment?
  
  (Asked by: username_0 on 2020-08-07)
  
  For MCTS there is an expansion phase where we make a move and list down all the next states. But this is complicated by the fact that for some games, after making the move, there is a stochastic change to the environment. Consider the game 2048, after I make a move, random tile is generated. So the state of the world after my next move is a mix of possibilities!
  
  How does MCTS work in a stochastic environment? I am having trouble understanding how to keep track of the expansion, do I expand all stochastic possibilities and weight the return via their chance of happening?
  
  **Tags:** monte-carlo-tree-search
  
  > **Comments:**
  > **username_1**: MCTS has been used for two-player games like Go, so maybe you could consider the random move as simply the move of the opponent.  
  > **username_0**: That is something I don't understand. In Go the player can have hundreds of different responses but you can use a metric to choose a branch (essentially, assuming your opponent plays optimally, but u r guess optimality with a heuristic). with random play you don't know which move will be played so you have to track through all possible moves.  
  > **username_1**: Yeah, I see your point. Maybe you could use random sequences (which are fixed for each tree search) of new tile positions? Of course, you would run into the complication of a new tile overlapping an existing tile in some iterations, so some way of countering that would need to be put in place.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-08-13. Score: 4
  
  > I am having trouble understanding how to keep track of the expansion, do I expand all stochastic possibilities and weight the return via their chance of happening?
  
  This is indeed one option you can take. This would be very similar in spirit to the idea of "Expectimax" as a variant of minimax for non-deterministic games, in the sense that you'll include explicit "chance nodes" in your tree. When running into such a chance node later on again during a Selection phase, of a later MCTS iteration, you can just select a path of the tree to follow based on a "dice roll". **Importantly**, note that this option is only actually available if you have explicit knowledge of exactly when chance events occur, which states they can lead to, and with which probabilities they lead to different states. We also assume that this is feasible, i.e. that you don't have a crazy high (or infinite) number of slightly different game states you could reach.
  
  An alternative option is to use an "open-loop" variant of MCTS. Your nodes would no longer represent game states, but only be representative of the sequence of actions leading to them. You would no longer store any game states in any nodes, but always regenerate them from scratch when traversing the tree, starting from the root node. You would no longer have any explicit chance nodes, but instead have states being representative of larger **sets of states** that could possibly be reached by following the corresponding path from the root node. For more on this, see [my answer to this other question](https://ai.stackexchange.com/a/13919/1641). The advantage of this approach is that it does not require explicit knowledge of all the possible states you can reach due to chance events, do not need explicit knowledge of the probabilities, and can just sample instead of explicitly enumerating every possible outcome.
  
  
  ---
  
  