POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs package

Submodules

POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_continuous_push_belief_factory module

POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_continuous_push_vectorized_updater module

Tests for the Continuous Push vectorized belief updater.

This module tests the vectorized batch transition and observation log-likelihood methods for the Continuous Push POMDP.

class POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_continuous_push_vectorized_updater.TestBeliefEquivalenceWithBaseline[source]

Bases: object

Belief-level equivalence checks against WeightedParticleBelief.

setup_method()[source]

Set up shared test fixtures.

test_sample_distributions_match_post_update()[source]

Test sample() on both beliefs draws unbiased from normalized_weights.

Purpose: Validates sample() unbiasedness and cross-belief agreement.

Given: 60 aligned particles; one update step seeded identically. When: 20,000 samples are drawn from each belief. Then: Empirical histograms agree and each matches its normalized_weights.

Test type: integration

test_update_particles_match()[source]

Test vectorized belief update produces identical next particles.

Purpose: Validates that VectorizedWeightedParticleBelief.update and

WeightedParticleBelief.update agree on next-state particles for continuous Push when the RNG is seeded identically on both paths.

Given: 60 aligned particles; both beliefs share the same updater. When: Both are updated with a 2D continuous action and fixed observation. Then: Next-particle arrays agree within floating-point tolerance.

Test type: integration

test_update_weights_match()[source]

Test vectorized and baseline beliefs produce identical normalized weights.

Purpose: Validates that observation-reweighting is consistent between

vectorized and per-particle update implementations.

Given: 60 aligned particles. When: Both are updated with the same action, observation, and seed. Then: Normalized weights agree within 1e-6 L-infinity.

Test type: integration

class POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_continuous_push_vectorized_updater.TestContinuousPushVectorizedUpdater[source]

Bases: object

Test the vectorized belief updater.

setup_method()[source]

Set up shared test fixtures.

test_batch_obs_log_likelihood_matches_per_particle_loop()[source]

Test vectorized log-likelihood matches per-particle observation_model.probability.

Purpose: Verifies that batch_observation_log_likelihood matches the

per-particle log(observation_model.probability) from the environment.

Given: A set of particles with object positions near the observation. When: batch_observation_log_likelihood is called, and per-particle

log-probabilities are computed.

Then: Results match within floating-point tolerance.

Test type: integration

test_batch_observation_log_likelihood_shape()[source]

Test that log-likelihood returns correct shape.

Purpose: Validates log-likelihood output shape.

Given: 50 particles and an observation. When: batch_observation_log_likelihood is called. Then: Returns shape (50,).

Test type: unit

test_batch_transition_matches_per_particle_loop()[source]

Test vectorized batch_transition matches per-particle state_transition_model.

Purpose: Verifies that batch_transition produces the same results as

calling the environment’s state_transition_model per particle with the same random seed.

Given: A set of particles with varied positions and a continuous action. When: batch_transition is called, and the same transitions are

computed per-particle via state_transition_model.

Then: Results match within floating-point tolerance.

Test type: integration

test_batch_transition_shape()[source]

Test that batch_transition returns correct shape.

Purpose: Validates output shape of batch transition.

Given: 50 particles of shape (50, 6) and a continuous action. When: batch_transition is called. Then: Returns shape (50, 6).

Test type: unit

test_batch_transition_target_preserved()[source]

Test that target position is unchanged after transition.

Purpose: Validates that target coordinates are preserved.

Given: Particles with known target positions. When: batch_transition is called. Then: Target columns (4:6) are unchanged.

Test type: unit

test_batch_transition_with_string_action()[source]

Test batch transition with string action (discrete wrapper).

Purpose: Validates string action resolution.

Given: Updater built from discrete-action environment. When: batch_transition is called with “right”. Then: Returns shape (50, 6) with robot moved right.

Test type: unit

test_config_id_deterministic()[source]

Test that config_id is deterministic.

Purpose: Validates deterministic config identification.

Given: Two updaters built from identical environments. When: config_id is accessed. Then: Both return the same string.

Test type: unit

test_from_environment_discrete()[source]

Test from_environment with discrete-action environment.

Purpose: Validates factory method with discrete wrapper.

Given: A ContinuousPushPOMDPDiscreteActions environment. When: from_environment is called. Then: Returns an updater with action_to_vector set.

Test type: unit

test_log_likelihood_finite()[source]

Test that log-likelihoods are finite.

Purpose: Validates numerical stability of log-likelihood.

Given: Particles and a reasonable observation. When: batch_observation_log_likelihood is called. Then: All values are finite.

Test type: unit

POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_push_belief_factory module

POMDPPlanners.tests.test_environments.test_push_pomdp.test_push_pomdp_beliefs.test_push_vectorized_updater module