POMCPOW

POMCP with observation widening and weighted particles. Where POMCP-DPW keeps an unweighted particle set per node, POMCPOW inserts the sampled state into the observation child’s belief with a weight, so the belief at a node approximates the true posterior instead of the set of states that happened to generate an identical observation. That is what makes it usable when observations are continuous and no two are ever equal.

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.pomcpow import POMCPOW
from POMDPPlanners.utils.action_samplers import DiscreteActionSampler

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

planner = POMCPOW(
    environment=tiger,
    discount_factor=0.95,
    depth=5,
    exploration_constant=1.0,
    k_o=3.0,
    k_a=3.0,
    alpha_o=0.5,
    alpha_a=0.5,
    action_sampler=action_sampler,
    time_out_in_seconds=2.0,
    name="ExamplePlanner",
)

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

Parameters

class POMDPPlanners.planners.mcts_planners.pomcpow.POMCPOW(environment, discount_factor, depth, exploration_constant, k_o, k_a, alpha_o, alpha_a, name, action_sampler, time_out_in_seconds=None, n_simulations=None, min_visit_count_per_action=1, reserve_capacity=0, log_path=None, debug=False, use_queue_logger=False)[source]

Bases: ArenaDoubleProgressiveWideningMCTSPolicy

POMCPOW 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
>>> from POMDPPlanners.utils.action_samplers import DiscreteActionSampler
>>> np.random.seed(42)
>>>
>>> tiger = TigerPOMDP(discount_factor=0.95)
>>> action_sampler = DiscreteActionSampler(tiger.get_actions())
>>> planner = POMCPOW(
...     environment=tiger,
...     discount_factor=0.95,
...     depth=5,
...     exploration_constant=1.0,
...     k_o=3.0,
...     k_a=3.0,
...     alpha_o=0.5,
...     alpha_a=0.5,
...     action_sampler=action_sampler,
...     n_simulations=10,
...     name="ExamplePlanner"
... )
>>> planner.name
'ExamplePlanner'
>>>
>>> initial_belief = get_initial_belief(tiger, n_particles=10)
>>> actions, run_data = planner.action(initial_belief)
Parameters:
  • environment (Environment)

  • discount_factor (float)

  • depth (int)

  • exploration_constant (float)

  • k_o (float)

  • k_a (float)

  • alpha_o (float)

  • alpha_a (float)

  • name (str)

  • action_sampler (ActionSampler)

  • time_out_in_seconds (int | None)

  • n_simulations (int | None)

  • min_visit_count_per_action (int)

  • reserve_capacity (int)

  • log_path (Path | None)

  • debug (bool)

  • use_queue_logger (bool)