POMCP

Partially Observable Monte Carlo Planning. POMCP grows a history tree from the current belief: each simulation descends the tree by UCB1, samples a state from the node’s particle set, steps the generative model, and finishes with a random rollout. Returns are averaged back up the path it came down. The belief at a node is the set of particles that reached it, so no explicit belief update is needed during the search.

Start with it on a discrete-action problem: it needs only depth, exploration_constant and a budget. Every other MCTS planner here modifies it.

Notes

Can I use?

Discrete

Continuous

State

✔️

✔️

Action

✔️

❌

Observation

✔️

❌

Also supports

Cost constraints

❌

GPU

❌

Example

import numpy as np
from POMDPPlanners.core.belief import get_initial_belief
from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP
from POMDPPlanners.planners.mcts_planners.pomcp import POMCP

np.random.seed(42)
tiger = TigerPOMDP(discount_factor=0.95)

planner = POMCP(
    environment=tiger,
    discount_factor=0.95,
    depth=5,
    exploration_constant=1.0,
    name="ExamplePlanner",
    time_out_in_seconds=2.0,
)

belief = get_initial_belief(tiger, n_particles=10)
actions, run_data = planner.action(belief)

Parameters

class POMDPPlanners.planners.mcts_planners.pomcp.POMCP(environment, discount_factor, depth, exploration_constant, name, time_out_in_seconds=None, n_simulations=None, reserve_capacity=0, log_path=None, debug=False, use_queue_logger=False)[source]

Bases: ArenaPathSimulationPolicy

POMCP operating on the arena Tree + integer node IDs.

See module docstring for algorithm details and reference.

Example

>>> import numpy as np
>>> from POMDPPlanners.environments.tiger_pomdp import TigerPOMDP
>>> from POMDPPlanners.core.belief import get_initial_belief
>>> np.random.seed(42)
>>>
>>> tiger = TigerPOMDP(discount_factor=0.95)
>>> planner = POMCP(
...     environment=tiger,
...     discount_factor=0.95,
...     depth=5,
...     exploration_constant=1.0,
...     name="ExamplePlanner",
...     n_simulations=10
... )
>>> planner.name
'ExamplePlanner'
>>>
>>> initial_belief = get_initial_belief(tiger, n_particles=10)
>>> actions, run_data = planner.action(initial_belief)
>>>
>>> space_info = POMCP.get_space_info()
>>> space_info.action_space.name
'DISCRETE'
Parameters:
get_explored_action_node(tree, belief_id)[source]

Pick an action child via UCB1; if any child has zero visits, pick uniformly from those.

Return type:

int

Parameters:
  • tree (Tree)

  • belief_id (int)

classmethod get_space_info()[source]

Get space type requirements for this policy class.

This class method specifies what types of action and observation spaces this policy implementation can handle, enabling compatibility checking with environments.

Return type:

PolicySpaceInfo

Returns:

PolicySpaceInfo specifying required action and observation space types

Note

Subclasses must implement this method to declare their space compatibility. This is used for validation when pairing policies with environments.