POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs package
- class POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.SafetyAntVelocityVectorizedUpdater(obs_dist, dt, mass, damping, max_force, force_scales)[source]
Bases:
VectorizedParticleBeliefUpdaterVectorized particle belief updater for the Safety Ant Velocity POMDP.
Performs all-particle transitions and observation log-likelihood evaluations using vectorized NumPy operations, replacing per-particle Python loops with batched array operations.
The transition is stochastic because force direction is uniformly random, so
batch_transitionsamples N independent force directions for N particles. Observations follow a diagonal Gaussian constructed from the environment’s position and velocity noise parameters.- Parameters:
obs_dist (CovarianceParameterizedMultivariateNormal)
dt (float)
mass (float)
damping (float)
max_force (float)
force_scales (np.ndarray)
- obs_dist
Observation noise distribution (4-D diagonal Gaussian).
- dt
Integration time step.
- mass
Agent mass.
- damping
Damping coefficient opposing velocity.
- max_force
Maximum force magnitude.
- force_scales
Force scaling factors for each discrete action.
Example
>>> import numpy as np >>> np.random.seed(42) >>> from POMDPPlanners.environments.safety_ant_velocity_pomdp import ( ... SafeAntVelocityPOMDP, ... ) >>> env = SafeAntVelocityPOMDP(discount_factor=0.99) >>> updater = SafetyAntVelocityVectorizedUpdater.from_environment(env) >>> particles = np.column_stack([ ... np.random.uniform(-1, 1, (50, 2)), ... np.zeros((50, 2)), ... ]) >>> action = 2 >>> next_p = updater.batch_transition(particles, action) >>> next_p.shape (50, 4) >>> obs = np.array([0.0, 0.0, 0.0, 0.0]) >>> ll = updater.batch_observation_log_likelihood(next_p, action, obs) >>> ll.shape (50,)
- batch_observation_log_likelihood(next_particles, action, observation)[source]
Compute observation log-likelihoods for all particles at once.
- batch_transition(particles, action)[source]
Transition all particles in a single batched operation.
- classmethod from_environment(env)[source]
Construct an updater from a SafeAntVelocityPOMDP instance.
- Parameters:
env (
SafeAntVelocityPOMDP) – Environment to extract parameters from.- Return type:
- Returns:
A new
SafetyAntVelocityVectorizedUpdaterinstance.
- POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.create_safety_ant_velocity_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]
Create a ready-to-use belief for the Safety Ant Velocity POMDP.
- Parameters:
env (
SafeAntVelocityPOMDP) – SafeAntVelocityPOMDP environment instance.belief_type (
BeliefType) – Desired belief representation. Defaults toBeliefType.VECTORIZED_PARTICLE.n_particles (
int) – Number of particles. Defaults to 200.
- Return type:
- Returns:
A configured
Beliefobject.- Raises:
ValueError – If belief_type is not supported.
Submodules
POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.safety_ant_velocity_belief_factory module
Belief factory for the Safety Ant Velocity POMDP.
- Functions:
- create_safety_ant_velocity_belief: Factory producing a configured belief
for SafeAntVelocityPOMDP.
- POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.safety_ant_velocity_belief_factory.create_safety_ant_velocity_belief(env, belief_type=BeliefType.VECTORIZED_PARTICLE, n_particles=200)[source]
Create a ready-to-use belief for the Safety Ant Velocity POMDP.
- Parameters:
env (
SafeAntVelocityPOMDP) – SafeAntVelocityPOMDP environment instance.belief_type (
BeliefType) – Desired belief representation. Defaults toBeliefType.VECTORIZED_PARTICLE.n_particles (
int) – Number of particles. Defaults to 200.
- Return type:
- Returns:
A configured
Beliefobject.- Raises:
ValueError – If belief_type is not supported.
POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.safety_ant_velocity_vectorized_updater module
Vectorized particle belief updater for the Safety Ant Velocity POMDP.
This module implements a concrete
VectorizedParticleBeliefUpdater
that performs batched state transitions and observation log-likelihood
evaluations for the Safety Ant Velocity environment, replacing
per-particle Python loops with NumPy array operations.
- Classes:
- SafetyAntVelocityVectorizedUpdater: Batched updater for the
Safety Ant Velocity POMDP.
- class POMDPPlanners.environments.safety_ant_velocity_pomdp.safety_ant_velocity_pomdp_beliefs.safety_ant_velocity_vectorized_updater.SafetyAntVelocityVectorizedUpdater(obs_dist, dt, mass, damping, max_force, force_scales)[source]
Bases:
VectorizedParticleBeliefUpdaterVectorized particle belief updater for the Safety Ant Velocity POMDP.
Performs all-particle transitions and observation log-likelihood evaluations using vectorized NumPy operations, replacing per-particle Python loops with batched array operations.
The transition is stochastic because force direction is uniformly random, so
batch_transitionsamples N independent force directions for N particles. Observations follow a diagonal Gaussian constructed from the environment’s position and velocity noise parameters.- Parameters:
obs_dist (CovarianceParameterizedMultivariateNormal)
dt (float)
mass (float)
damping (float)
max_force (float)
force_scales (np.ndarray)
- obs_dist
Observation noise distribution (4-D diagonal Gaussian).
- dt
Integration time step.
- mass
Agent mass.
- damping
Damping coefficient opposing velocity.
- max_force
Maximum force magnitude.
- force_scales
Force scaling factors for each discrete action.
Example
>>> import numpy as np >>> np.random.seed(42) >>> from POMDPPlanners.environments.safety_ant_velocity_pomdp import ( ... SafeAntVelocityPOMDP, ... ) >>> env = SafeAntVelocityPOMDP(discount_factor=0.99) >>> updater = SafetyAntVelocityVectorizedUpdater.from_environment(env) >>> particles = np.column_stack([ ... np.random.uniform(-1, 1, (50, 2)), ... np.zeros((50, 2)), ... ]) >>> action = 2 >>> next_p = updater.batch_transition(particles, action) >>> next_p.shape (50, 4) >>> obs = np.array([0.0, 0.0, 0.0, 0.0]) >>> ll = updater.batch_observation_log_likelihood(next_p, action, obs) >>> ll.shape (50,)
- batch_observation_log_likelihood(next_particles, action, observation)[source]
Compute observation log-likelihoods for all particles at once.
- batch_transition(particles, action)[source]
Transition all particles in a single batched operation.
- classmethod from_environment(env)[source]
Construct an updater from a SafeAntVelocityPOMDP instance.
- Parameters:
env (
SafeAntVelocityPOMDP) – Environment to extract parameters from.- Return type:
- Returns:
A new
SafetyAntVelocityVectorizedUpdaterinstance.