Use Gumbel MuZero policy
mainMctx provides high-level concrete policies like muzero_policy and gumbel_muzero_policy. It is recommended to use gumbel_muzero_policy as it guarantees policy improvement if action values are correctly evaluated.
To use the policy, you must provide:
params: Model parameters.rng_key: JAX random key.root: ARootFnOutputcontainingprior_logits,value, and anembeddingfor the root state.recurrent_fn: A dynamics model function with the signaturerecurrent_fn(params, rng_key, action, embedding). It must return a tuple(RecurrentFnOutput, new_embedding), whereRecurrentFnOutputcontainsreward,discount,prior_logits, andvalue.num_simulations: The number of MCTS simulations to perform.
The returned policy_output contains:
action: The action proposed by the search.action_weights: Targets usable to train the policy probabilities.
policy_output = mctx.gumbel_muzero_policy(params, rng_key, root, recurrent_fn,
num_simulations=32)