POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs package

class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.ContinuousLaserTagVectorizedUpdater(walls, grid_size, robot_radius, opponent_radius, tag_radius, evasion_speed, measurement_noise, robot_covariance, opponent_covariance, action_to_vector=None, opponent_policy=OpponentPolicy.EVADE)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the Continuous LaserTag POMDP.

Performs all-particle transitions and observation log-likelihood evaluations by delegating to the native _native C++ extension’s batch entry points. The explicit vectorized path and the per-particle env.sample_next_state path now share the same C++ RNG, closing the cross-path divergence that previously forced the equivalence tests to seed each particle individually.

Parameters:
  • walls (np.ndarray)

  • grid_size (np.ndarray)

  • robot_radius (float)

  • opponent_radius (float)

  • tag_radius (float)

  • evasion_speed (float)

  • measurement_noise (float)

  • robot_covariance (np.ndarray)

  • opponent_covariance (np.ndarray)

  • action_to_vector (Optional[Dict[str, np.ndarray]])

  • opponent_policy (OpponentPolicy)

walls

Shape (M, 4) wall AABB array.

grid_size

Shape (2,) arena dimensions.

robot_radius

Robot body radius.

opponent_radius

Opponent body radius.

tag_radius

Maximum tag distance.

evasion_speed

Mean opponent evasion step magnitude.

measurement_noise

Laser measurement noise std.

robot_covariance

Shape (2, 2) robot transition noise covariance.

opponent_covariance

Shape (2, 2) opponent transition noise covariance.

Example

>>> import numpy as np
>>> np.random.seed(42)
>>> from POMDPPlanners.environments.laser_tag_pomdp.continuous_laser_tag_pomdp import (
...     ContinuousLaserTagPOMDP,
... )
>>> env = ContinuousLaserTagPOMDP(discount_factor=0.95)
>>> updater = ContinuousLaserTagVectorizedUpdater.from_environment(env)
>>> state = env.initial_state_dist().sample()[0]
>>> particles = np.tile(state, (50, 1))
>>> action = np.array([1.0, 0.0, 0.0])
>>> next_p = updater.batch_transition(particles, action)
>>> next_p.shape[1]
5
>>> obs = env.sample_observation(state, action)
>>> ll = updater.batch_observation_log_likelihood(next_p, action, obs)
>>> ll.shape[0]
50
batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles at once.

Parameters:
  • next_particles (ndarray) – Transitioned particle states of shape (N, d).

  • action (ndarray) – Action vector.

  • observation (ndarray) – Observed value.

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles in a single batched operation.

Parameters:
  • particles (ndarray) – Current particle states of shape (N, d).

  • action (ndarray) – Action vector.

Return type:

ndarray

Returns:

Next-state particles of shape (N, d).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a ContinuousLaserTagPOMDP instance.

Return type:

ContinuousLaserTagVectorizedUpdater

Parameters:

env (ContinuousLaserTagPOMDP)

class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.LaserTagVectorizedUpdater(floor_shape, valid_cell, wall_dist_table, measurement_noise, transition_error_prob, opponent_policy=OpponentPolicy.EVADE)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the LaserTag POMDP.

Performs all-particle transitions and observation log-likelihood evaluations using vectorized NumPy operations. Precomputed lookup tables for wall distances and valid cells replace per-ray Python loops at update time.

Parameters:
  • floor_shape (Tuple[int, int])

  • valid_cell (np.ndarray)

  • wall_dist_table (np.ndarray)

  • measurement_noise (float)

  • transition_error_prob (float)

  • opponent_policy (OpponentPolicy)

floor_shape

Grid dimensions as (rows, cols).

valid_cell

Boolean array of shape (rows, cols).

wall_dist_table

Integer array of shape (rows, cols, 8).

measurement_noise

Standard deviation of laser measurement noise.

transition_error_prob

Probability of executing a random movement.

Example

>>> import numpy as np
>>> np.random.seed(42)
>>> from POMDPPlanners.environments.laser_tag_pomdp import LaserTagPOMDP
>>> env = LaserTagPOMDP(discount_factor=0.95)
>>> updater = LaserTagVectorizedUpdater.from_environment(env)
>>> state = env.initial_state_dist().sample()[0]
>>> particles = np.tile(state, (50, 1))
>>> action = 0  # North
>>> next_p = updater.batch_transition(particles, action)
>>> next_p.shape[1]
5
>>> obs = env.sample_observation(next_state=state, action=action)
>>> obs_arr = np.array(obs, dtype=float)
>>> ll = updater.batch_observation_log_likelihood(next_p, action, obs_arr)
>>> ll.shape[0]
50
batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles at once.

Parameters:
  • next_particles (ndarray) – Transitioned particle states of shape (N, d).

  • action (ndarray) – Action vector.

  • observation (ndarray) – Observed value.

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles in a single batched operation.

Parameters:
  • particles (ndarray) – Current particle states of shape (N, d).

  • action (ndarray) – Action vector.

Return type:

ndarray

Returns:

Next-state particles of shape (N, d).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a LaserTagPOMDP instance.

Parameters:

env (LaserTagPOMDP) – Environment to extract parameters from.

Return type:

LaserTagVectorizedUpdater

Returns:

A new LaserTagVectorizedUpdater instance.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.create_continuous_laser_tag_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]

Create a ready-to-use belief for the Continuous LaserTag POMDP.

Parameters:
  • env (ContinuousLaserTagPOMDP) – ContinuousLaserTagPOMDP (or discrete-action variant) instance.

  • belief_type (BeliefType) – Desired belief representation. Defaults to BeliefType.VECTORIZED_PARTICLE.

  • n_particles (int) – Number of particles. Defaults to 200.

Return type:

Belief

Returns:

A configured Belief object.

Raises:

ValueError – If belief_type is not supported.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.create_laser_tag_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]

Create a ready-to-use belief for the LaserTag POMDP.

Parameters:
  • env (LaserTagPOMDP) – LaserTagPOMDP environment instance.

  • belief_type (BeliefType) – Desired belief representation. Defaults to BeliefType.VECTORIZED_PARTICLE.

  • n_particles (int) – Number of particles. Defaults to 200.

Return type:

Belief

Returns:

A configured Belief object.

Raises:

ValueError – If belief_type is not supported.

Submodules

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.continuous_laser_tag_belief_factory module

Belief factory for the Continuous LaserTag POMDP.

Functions:
create_continuous_laser_tag_belief: Factory producing a configured

belief for ContinuousLaserTagPOMDP or its discrete-action variant.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.continuous_laser_tag_belief_factory.create_continuous_laser_tag_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]

Create a ready-to-use belief for the Continuous LaserTag POMDP.

Parameters:
  • env (ContinuousLaserTagPOMDP) – ContinuousLaserTagPOMDP (or discrete-action variant) instance.

  • belief_type (BeliefType) – Desired belief representation. Defaults to BeliefType.VECTORIZED_PARTICLE.

  • n_particles (int) – Number of particles. Defaults to 200.

Return type:

Belief

Returns:

A configured Belief object.

Raises:

ValueError – If belief_type is not supported.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.continuous_laser_tag_vectorized_updater module

Vectorized particle belief updater for the Continuous LaserTag POMDP.

This module implements a concrete VectorizedParticleBeliefUpdater that performs batched state transitions and observation log-likelihood evaluations for the Continuous LaserTag environment.

batch_transition delegates to the native _native C++ extension’s ContinuousLaserTagTransitionCpp.batch_sample so both the explicit vectorized path and the per-particle env.sample_next_state path share the same C++ RNG (the Python-side numpy loop used before was what forced the cross-path skip in the baseline equivalence tests). batch_observation_log_likelihood delegates to ContinuousLaserTagObservationCpp.batch_log_likelihood.

Classes:
ContinuousLaserTagVectorizedUpdater: Batched updater for the

Continuous LaserTag POMDP.

class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.continuous_laser_tag_vectorized_updater.ContinuousLaserTagVectorizedUpdater(walls, grid_size, robot_radius, opponent_radius, tag_radius, evasion_speed, measurement_noise, robot_covariance, opponent_covariance, action_to_vector=None, opponent_policy=OpponentPolicy.EVADE)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the Continuous LaserTag POMDP.

Performs all-particle transitions and observation log-likelihood evaluations by delegating to the native _native C++ extension’s batch entry points. The explicit vectorized path and the per-particle env.sample_next_state path now share the same C++ RNG, closing the cross-path divergence that previously forced the equivalence tests to seed each particle individually.

Parameters:
  • walls (np.ndarray)

  • grid_size (np.ndarray)

  • robot_radius (float)

  • opponent_radius (float)

  • tag_radius (float)

  • evasion_speed (float)

  • measurement_noise (float)

  • robot_covariance (np.ndarray)

  • opponent_covariance (np.ndarray)

  • action_to_vector (Optional[Dict[str, np.ndarray]])

  • opponent_policy (OpponentPolicy)

walls

Shape (M, 4) wall AABB array.

grid_size

Shape (2,) arena dimensions.

robot_radius

Robot body radius.

opponent_radius

Opponent body radius.

tag_radius

Maximum tag distance.

evasion_speed

Mean opponent evasion step magnitude.

measurement_noise

Laser measurement noise std.

robot_covariance

Shape (2, 2) robot transition noise covariance.

opponent_covariance

Shape (2, 2) opponent transition noise covariance.

Example

>>> import numpy as np
>>> np.random.seed(42)
>>> from POMDPPlanners.environments.laser_tag_pomdp.continuous_laser_tag_pomdp import (
...     ContinuousLaserTagPOMDP,
... )
>>> env = ContinuousLaserTagPOMDP(discount_factor=0.95)
>>> updater = ContinuousLaserTagVectorizedUpdater.from_environment(env)
>>> state = env.initial_state_dist().sample()[0]
>>> particles = np.tile(state, (50, 1))
>>> action = np.array([1.0, 0.0, 0.0])
>>> next_p = updater.batch_transition(particles, action)
>>> next_p.shape[1]
5
>>> obs = env.sample_observation(state, action)
>>> ll = updater.batch_observation_log_likelihood(next_p, action, obs)
>>> ll.shape[0]
50
batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles at once.

Parameters:
  • next_particles (ndarray) – Transitioned particle states of shape (N, d).

  • action (ndarray) – Action vector.

  • observation (ndarray) – Observed value.

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles in a single batched operation.

Parameters:
  • particles (ndarray) – Current particle states of shape (N, d).

  • action (ndarray) – Action vector.

Return type:

ndarray

Returns:

Next-state particles of shape (N, d).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a ContinuousLaserTagPOMDP instance.

Return type:

ContinuousLaserTagVectorizedUpdater

Parameters:

env (ContinuousLaserTagPOMDP)

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.laser_tag_belief_factory module

Belief factory for the LaserTag POMDP.

Functions:

create_laser_tag_belief: Factory producing a configured belief for LaserTagPOMDP.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.laser_tag_belief_factory.create_laser_tag_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]

Create a ready-to-use belief for the LaserTag POMDP.

Parameters:
  • env (LaserTagPOMDP) – LaserTagPOMDP environment instance.

  • belief_type (BeliefType) – Desired belief representation. Defaults to BeliefType.VECTORIZED_PARTICLE.

  • n_particles (int) – Number of particles. Defaults to 200.

Return type:

Belief

Returns:

A configured Belief object.

Raises:

ValueError – If belief_type is not supported.

POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.laser_tag_vectorized_updater module

Vectorized particle belief updater for the LaserTag POMDP.

This module implements a concrete VectorizedParticleBeliefUpdater that performs batched state transitions and observation log-likelihood evaluations for the LaserTag environment.

The hot inner kernels (per-particle transition with opponent-move sampling and per-particle 8-direction laser measurement / Gaussian log-likelihood) are implemented in C++ via the POMDPPlanners.environments.laser_tag_pomdp._native extension; the Python class is a thin wrapper that pre-flattens the lookup tables and dispatches to the native kernels.

Wall-distance lookup tables are precomputed once at construction time so that laser measurements and collision checks use fast array indexing rather than per-ray Python loops at update time.

Classes:

LaserTagVectorizedUpdater: Batched updater for the LaserTag POMDP.

class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_beliefs.laser_tag_vectorized_updater.LaserTagVectorizedUpdater(floor_shape, valid_cell, wall_dist_table, measurement_noise, transition_error_prob, opponent_policy=OpponentPolicy.EVADE)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the LaserTag POMDP.

Performs all-particle transitions and observation log-likelihood evaluations using vectorized NumPy operations. Precomputed lookup tables for wall distances and valid cells replace per-ray Python loops at update time.

Parameters:
  • floor_shape (Tuple[int, int])

  • valid_cell (np.ndarray)

  • wall_dist_table (np.ndarray)

  • measurement_noise (float)

  • transition_error_prob (float)

  • opponent_policy (OpponentPolicy)

floor_shape

Grid dimensions as (rows, cols).

valid_cell

Boolean array of shape (rows, cols).

wall_dist_table

Integer array of shape (rows, cols, 8).

measurement_noise

Standard deviation of laser measurement noise.

transition_error_prob

Probability of executing a random movement.

Example

>>> import numpy as np
>>> np.random.seed(42)
>>> from POMDPPlanners.environments.laser_tag_pomdp import LaserTagPOMDP
>>> env = LaserTagPOMDP(discount_factor=0.95)
>>> updater = LaserTagVectorizedUpdater.from_environment(env)
>>> state = env.initial_state_dist().sample()[0]
>>> particles = np.tile(state, (50, 1))
>>> action = 0  # North
>>> next_p = updater.batch_transition(particles, action)
>>> next_p.shape[1]
5
>>> obs = env.sample_observation(next_state=state, action=action)
>>> obs_arr = np.array(obs, dtype=float)
>>> ll = updater.batch_observation_log_likelihood(next_p, action, obs_arr)
>>> ll.shape[0]
50
batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles at once.

Parameters:
  • next_particles (ndarray) – Transitioned particle states of shape (N, d).

  • action (ndarray) – Action vector.

  • observation (ndarray) – Observed value.

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles in a single batched operation.

Parameters:
  • particles (ndarray) – Current particle states of shape (N, d).

  • action (ndarray) – Action vector.

Return type:

ndarray

Returns:

Next-state particles of shape (N, d).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a LaserTagPOMDP instance.

Parameters:

env (LaserTagPOMDP) – Environment to extract parameters from.

Return type:

LaserTagVectorizedUpdater

Returns:

A new LaserTagVectorizedUpdater instance.