POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs package

RockSample POMDP belief support with vectorized particle filter.

class POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.RockSampleVectorizedUpdater(map_rows, map_cols, num_rocks, rock_positions, sensor_efficiency)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the RockSample POMDP.

Stores precomputed environment parameters and performs all-particle transitions and observation log-likelihood evaluations using NumPy operations. State layout per particle is [robot_row, robot_col, rock_0_quality, ..., rock_{R-1}_quality].

Parameters:
  • map_rows (int)

  • map_cols (int)

  • num_rocks (int)

  • rock_positions (np.ndarray)

  • sensor_efficiency (float)

map_rows

Number of grid rows.

map_cols

Number of grid columns.

num_rocks

Number of rocks in the environment.

rock_positions

Array of shape (R, 2) with rock (row, col) positions.

sensor_efficiency

Sensor noise parameter (higher = less noise).

batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles.

Parameters:
  • next_particles (ndarray) – Array of shape (N, 2 + num_rocks).

  • action (ndarray) – Scalar action index.

  • observation (ndarray) – Integer-encoded observation (0=none, 1=good, 2=bad).

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles for the given action.

Parameters:
  • particles (ndarray) – Array of shape (N, 2 + num_rocks).

  • action (ndarray) – Scalar action index.

Return type:

ndarray

Returns:

Next-state particles of shape (N, 2 + num_rocks).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a RockSamplePOMDP instance.

Return type:

RockSampleVectorizedUpdater

Parameters:

env (RockSamplePOMDP)

POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.create_rocksample_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200, **kwargs)[source]

Create a belief object for the RockSample POMDP.

Parameters:
  • env (RockSamplePOMDP) – RockSample environment instance.

  • belief_type (BeliefType) – Desired belief representation. Supports PARTICLE and VECTORIZED_PARTICLE.

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

  • **kwargs (Any) – Reserved for future use.

Return type:

Belief

Returns:

A configured belief object.

Raises:

ValueError – If belief_type is not supported.

Submodules

POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.rocksample_belief_factory module

Belief factory for RockSample POMDP.

This module provides a factory function for creating belief objects for the RockSample environment, supporting both standard weighted particle beliefs and vectorized particle beliefs.

Classes:
RockSampleVectorizedWeightedParticleBelief: Thin subclass that handles

string-to-integer observation encoding for RockSample.

Functions:

create_rocksample_belief: Factory returning a configured Belief.

class POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.rocksample_belief_factory.RockSampleVectorizedWeightedParticleBelief(particles, log_weights, updater, resampling=False, ess_factor=0.5)[source]

Bases: VectorizedWeightedParticleBelief

Vectorized weighted particle belief with string observation encoding.

RockSample observations are strings ("none", "good", "bad"), but the parent class expects numeric observations. This subclass transparently encodes string observations to integers before delegating to the vectorized updater.

Parameters:
update(action, observation, pomdp=None, state=None)[source]

Update belief, encoding string observations to integers.

Return type:

RockSampleVectorizedWeightedParticleBelief

Parameters:
POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.rocksample_belief_factory.create_rocksample_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200, **kwargs)[source]

Create a belief object for the RockSample POMDP.

Parameters:
  • env (RockSamplePOMDP) – RockSample environment instance.

  • belief_type (BeliefType) – Desired belief representation. Supports PARTICLE and VECTORIZED_PARTICLE.

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

  • **kwargs (Any) – Reserved for future use.

Return type:

Belief

Returns:

A configured belief object.

Raises:

ValueError – If belief_type is not supported.

POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.rocksample_vectorized_updater module

Vectorized particle belief updater for RockSample POMDP.

This module provides a NumPy-vectorized implementation of particle belief updates for the RockSample environment, eliminating Python-level loops over individual particles.

Classes:
RockSampleVectorizedUpdater: Batched transition and observation

log-likelihood for RockSample states.

class POMDPPlanners.environments.rock_sample_pomdp.rock_sample_pomdp_beliefs.rocksample_vectorized_updater.RockSampleVectorizedUpdater(map_rows, map_cols, num_rocks, rock_positions, sensor_efficiency)[source]

Bases: VectorizedParticleBeliefUpdater

Vectorized particle belief updater for the RockSample POMDP.

Stores precomputed environment parameters and performs all-particle transitions and observation log-likelihood evaluations using NumPy operations. State layout per particle is [robot_row, robot_col, rock_0_quality, ..., rock_{R-1}_quality].

Parameters:
  • map_rows (int)

  • map_cols (int)

  • num_rocks (int)

  • rock_positions (np.ndarray)

  • sensor_efficiency (float)

map_rows

Number of grid rows.

map_cols

Number of grid columns.

num_rocks

Number of rocks in the environment.

rock_positions

Array of shape (R, 2) with rock (row, col) positions.

sensor_efficiency

Sensor noise parameter (higher = less noise).

batch_observation_log_likelihood(next_particles, action, observation)[source]

Compute observation log-likelihoods for all particles.

Parameters:
  • next_particles (ndarray) – Array of shape (N, 2 + num_rocks).

  • action (ndarray) – Scalar action index.

  • observation (ndarray) – Integer-encoded observation (0=none, 1=good, 2=bad).

Return type:

ndarray

Returns:

Log-likelihoods of shape (N,).

batch_transition(particles, action)[source]

Transition all particles for the given action.

Parameters:
  • particles (ndarray) – Array of shape (N, 2 + num_rocks).

  • action (ndarray) – Scalar action index.

Return type:

ndarray

Returns:

Next-state particles of shape (N, 2 + num_rocks).

property config_id: str

Return a deterministic identifier for this updater configuration.

classmethod from_environment(env)[source]

Construct an updater from a RockSamplePOMDP instance.

Return type:

RockSampleVectorizedUpdater

Parameters:

env (RockSamplePOMDP)