Answers.Body: <p>You can try using an "Open-Loop" MCTS approach, instead of the standard "closed-loop" one, and eliminate chance nodes altogether. See, for example, <a href="http://www.diego-perez.net/papers/OpenLoopGVG.pdf" rel="noreferrer">Open Loop Search for General Video Game Playing</a>.</p>
  
  <p>In a "standard" (closed-loop) implementation, you would store a game state in every normal (non-chance) node. Whenever there is a chance event, you would stochastically traverse to one of its children, and then have a normal node with a "deterministic" game state again.</p>
  
  <p>In an open-loop approach, you do not store game states in any node (except possibly the root nodes), because nodes no longer deterministically correspond to specific game states. <strong>Every node in an open-loop MCTS approach only corresponds to the sequence of actions that leads to it from the root node</strong>. This completely eliminates the need for chance nodes, and results in a significantly smaller tree because you only need a single path in your tree for every possible unique sequence of actions. A single sequence of actions may, depending on stochastic events, lead to a distribution over possible game states.</p>
  
  <p>In every separate MCTS iteration, you would re-generate game states again by applying moves "along the edges" as you traverse through the tree. You also "roll the dice" again for any stochastic events. If your MCTS iteration traverses a certain path of the tree often enough, it will still be able to observe all the possible stochastic events through sampling.</p>
  
  <p>Note that, <strong>given an infinite amount of time, the closed-loop approach with explicit chance nodes will likely perform much better</strong>. But when you have a small amount of time (as is the case in the real-time video game setting considered in the paper I linked above), an open-loop approach without explicit chance nodes may perform better.</p>
  
  <hr>
  
  <p>Alternatively, if you prefer the closed-loop approach with explicit chance nodes, you could try some mix of:</p>
  
  <ul>
  <li>Allowing MCTS to prioritise promising parts of the search tree over parts that have not been visited at all (i.e. do not automatically prioritise nodes with <span class="math-container">$0$</span> visits). For example, instead of giving unvisited node a value estimate of <span class="math-container">$\infty$</span> (this is how you could interpret the automatic selection of them), you could give them a value estimate equal to the value estimate of the parent node, and just apply the UCB1 equation directly.</li>
  <li>Use AMAF value estimates / RAVE / <a href="https://www.lamsade.dauphine.fr/~cazenave/papers/grave.pdf" rel="noreferrer">GRAVE</a> in your selection phase. This allows you to very quickly learn some crude value estimates for moves that you have never selected in the Selection phase yet, by generalising from observations of playing them in the Play-out phase. I have noticed that the "standard" implementation of RAVE / GRAVE, without an explicit UCB-like exploration term, does not mix well with my previous suggestion of using a non-infinite value estimate for unvisited children. It may be good to consider a UCB-like variant with an explicit exploration term instead.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-01T00:29:20.220Z
Answers.Text: Why do you say that, given an infinite amount of time, the closed-loop approach with explicit chance nodes will likely perform much better?
Answers.UserDisplayName: user76284
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-01T10:14:53.307Z
Answers.Text: @user76284 If we explicitly model a chance node, we get separate nodes below it for every state that we could end up in after the stochastic effects have been resolved. This allows us to "observe" what state we've ended up in (for example, observe which outcome we get for a dice roll), and make a more informed decision based on exactly which outcome we ended up getting. Without explicit chance nodes, you're essentially "averaging" your actions across all possible states you could've ended up in; you'll pick the best "average" action across all possible dice outcomes, ignoring the actual result
Answers.UserDisplayName: Dennis Soemers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T15:15:22.987Z
Answers.LastActivityDate: 2019-08-12T15:15:22.987Z
Answers.UserDisplayName: Dennis Soemers
Answers.Body: <p>I would have a look at progressive widening, which was created to address the problem of applying MCTS to continuous stochastic environments. That is, where the probability of encountering the same state twice in simulating a chance node is <span class="math-container">$0$</span>.</p>
  <p>The original paper for DPW (Double Progressive Widening) can be found here <a href="https://hal.science/hal-00542673v2/file/c0mcts.pdf" rel="nofollow noreferrer">https://hal.science/hal-00542673v2/file/c0mcts.pdf</a>. DPW addresses the case where both action and state spaces are continuous, but you can ablate it if you only have or the other.</p>
  <p>The main idea is that you expand the chance node a few times and then revisit those expansions. When you've saturated existing outcomes according to some hyperparameter, you then randomly sample the chance node.</p>
  <p>It has a few limitations, for example the rate at which you sample new nodes is fixed and has to be determined experimentally. In some environments, the optimal rate is dependent on the state itself which leads to more complex techniques. For your problem though, it sounds like it may be a good fit.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-11T11:46:13.523Z
Answers.LastActivityDate: 2023-07-11T11:46:13.523Z
Answers.UserDisplayName: Venna Banana
Answers.Body: <p>If you have that sort of a priori knowledge about your environment it, as you said, will simplify the problem substantially. From what I gather you have done a good amount of background research and simply want to apply UTC MCTS(or similar) to the environment. You mention that "chance nodes won't ever be repeated in the selection phase".</p>
  
  <p>If I understand what you are asking correctly, you can simply use what you know to alter the way you search nodes of the tree. I.e you can essentially act greedily wrt the initial chance nodes and then slowly decay that search strategy as the training progresses(to avoid convergence to local maxima).</p>
  
  <p>I encourage you to dig a bit deeper into the methods around exploration vs. exploitation as there may be an elegant solution to this problem in particular.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T11:24:53.363Z
Answers.LastActivityDate: 2019-08-12T11:24:53.363Z
Answers.UserDisplayName: hisairnessag3
Body: <p>I'm trying to use a Monte Carlo Tree Search for a non-deterministic game. Apparently, one of the standard approaches is to model non-determinism using <em>chance nodes</em>. The problem for this game is that it has a very high min-entropy for the random events (imagine the shuffle of a deck of cards), and consequently a very large branching factor (<span class="math-container">$\approx 2^{32}$</span>) if I were to model this as a chance node.</p>
  
  <p>Despite this issue, there are a few things that likely make the search more tractable:</p>
  
  <ol>
  <li>Chance nodes only occur a few times per game, not after every move.</li>
  <li>The chance events do not depend on player actions.</li>
  <li>Even if two random outcomes are distinct, they might be "similar to each other", and that would lead to game outcomes that are also similar.</li>
  </ol>
  
  <p>So far all approaches that I've found to MCTS for non-deterministic games use UCT-like policies (e.g. chapter 4 of <a href="https://arxiv.org/pdf/0909.0801.pdf" rel="noreferrer">A Monte-Carlo AIXI Approximation</a>) to select chance nodes, which weight unexplored nodes maximally. In my case, I think this will lead to fully random playouts since any chance node won't ever be repeated in the selection phase.</p>
  
  <p>What is the best way to approach this problem? Has research been done on this? Naively, I was thinking of a policy that favors repeating chance nodes more over always exploring new ones.</p>
  
Tags: <monte-carlo-tree-search><games-of-chance>
Title: MCTS for non-deterministic games with very high branching factor for chance nodes
UserDisplayName: Mark
ThreadText: # MCTS for non-deterministic games with very high branching factor for chance nodes
  
  (Asked by: username_0 on 2019-08-09)
  
  I'm trying to use a Monte Carlo Tree Search for a non-deterministic game. Apparently, one of the standard approaches is to model non-determinism using *chance nodes*. The problem for this game is that it has a very high min-entropy for the random events (imagine the shuffle of a deck of cards), and consequently a very large branching factor ($\approx 2^{32}$) if I were to model this as a chance node.
  
  Despite this issue, there are a few things that likely make the search more tractable:
  
  1. Chance nodes only occur a few times per game, not after every move.
  2. The chance events do not depend on player actions.
  3. Even if two random outcomes are distinct, they might be "similar to each other", and that would lead to game outcomes that are also similar.
  
  So far all approaches that I've found to MCTS for non-deterministic games use UCT-like policies (e.g. chapter 4 of [A Monte-Carlo AIXI Approximation](https://arxiv.org/pdf/0909.0801.pdf)) to select chance nodes, which weight unexplored nodes maximally. In my case, I think this will lead to fully random playouts since any chance node won't ever be repeated in the selection phase.
  
  What is the best way to approach this problem? Has research been done on this? Naively, I was thinking of a policy that favors repeating chance nodes more over always exploring new ones.
  
  **Tags:** monte-carlo-tree-search, games-of-chance
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-08-12. Score: 7
  
  You can try using an "Open-Loop" MCTS approach, instead of the standard "closed-loop" one, and eliminate chance nodes altogether. See, for example, [Open Loop Search for General Video Game Playing](http://www.diego-perez.net/papers/OpenLoopGVG.pdf).
  
  In a "standard" (closed-loop) implementation, you would store a game state in every normal (non-chance) node. Whenever there is a chance event, you would stochastically traverse to one of its children, and then have a normal node with a "deterministic" game state again.
  
  In an open-loop approach, you do not store game states in any node (except possibly the root nodes), because nodes no longer deterministically correspond to specific game states. **Every node in an open-loop MCTS approach only corresponds to the sequence of actions that leads to it from the root node**. This completely eliminates the need for chance nodes, and results in a significantly smaller tree because you only need a single path in your tree for every possible unique sequence of actions. A single sequence of actions may, depending on stochastic events, lead to a distribution over possible game states.
  
  In every separate MCTS iteration, you would re-generate game states again by applying moves "along the edges" as you traverse through the tree. You also "roll the dice" again for any stochastic events. If your MCTS iteration traverses a certain path of the tree often enough, it will still be able to observe all the possible stochastic events through sampling.
  
  Note that, **given an infinite amount of time, the closed-loop approach with explicit chance nodes will likely perform much better**. But when you have a small amount of time (as is the case in the real-time video game setting considered in the paper I linked above), an open-loop approach without explicit chance nodes may perform better.
  
  ---
  
  Alternatively, if you prefer the closed-loop approach with explicit chance nodes, you could try some mix of:
  
  * Allowing MCTS to prioritise promising parts of the search tree over parts that have not been visited at all (i.e. do not automatically prioritise nodes with $0$ visits). For example, instead of giving unvisited node a value estimate of $\infty$ (this is how you could interpret the automatic selection of them), you could give them a value estimate equal to the value estimate of the parent node, and just apply the UCB1 equation directly.
  * Use AMAF value estimates / RAVE / [GRAVE](https://www.lamsade.dauphine.fr/~cazenave/papers/grave.pdf) in your selection phase. This allows you to very quickly learn some crude value estimates for moves that you have never selected in the Selection phase yet, by generalising from observations of playing them in the Play-out phase. I have noticed that the "standard" implementation of RAVE / GRAVE, without an explicit UCB-like exploration term, does not mix well with my previous suggestion of using a non-infinite value estimate for unvisited children. It may be good to consider a UCB-like variant with an explicit exploration term instead.
  
  > **Comments:**
  > **username_2**: Why do you say that, given an infinite amount of time, the closed-loop approach with explicit chance nodes will likely perform much better?  
  > **username_1**: @username_2 If we explicitly model a chance node, we get separate nodes below it for every state that we could end up in after the stochastic effects have been resolved. This allows us to "observe" what state we've ended up in (for example, observe which outcome we get for a dice roll), and make a more informed decision based on exactly which outcome we ended up getting. Without explicit chance nodes, you're essentially "averaging" your actions across all possible states you could've ended up in; you'll pick the best "average" action across all possible dice outcomes, ignoring the actual result  
  
  ---
  
  ### Answer by username_3 on 2023-07-11. Score: 1
  
  I would have a look at progressive widening, which was created to address the problem of applying MCTS to continuous stochastic environments. That is, where the probability of encountering the same state twice in simulating a chance node is $0$.
  
  The original paper for DPW (Double Progressive Widening) can be found here <https://hal.science/hal-00542673v2/file/c0mcts.pdf>. DPW addresses the case where both action and state spaces are continuous, but you can ablate it if you only have or the other.
  
  The main idea is that you expand the chance node a few times and then revisit those expansions. When you've saturated existing outcomes according to some hyperparameter, you then randomly sample the chance node.
  
  It has a few limitations, for example the rate at which you sample new nodes is fixed and has to be determined experimentally. In some environments, the optimal rate is dependent on the state itself which leads to more complex techniques. For your problem though, it sounds like it may be a good fit.
  
  
  ---
  
  ### Answer by username_4 on 2019-08-12. Score: 0
  
  If you have that sort of a priori knowledge about your environment it, as you said, will simplify the problem substantially. From what I gather you have done a good amount of background research and simply want to apply UTC MCTS(or similar) to the environment. You mention that "chance nodes won't ever be repeated in the selection phase".
  
  If I understand what you are asking correctly, you can simply use what you know to alter the way you search nodes of the tree. I.e you can essentially act greedily wrt the initial chance nodes and then slowly decay that search strategy as the training progresses(to avoid convergence to local maxima).
  
  I encourage you to dig a bit deeper into the methods around exploration vs. exploitation as there may be an elegant solution to this problem in particular.
  
  
  ---
  
  