POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils package
Shared utilities for the LaserTag POMDP environments.
- Classes:
- OpponentPolicy: Selectable opponent transition behaviour (evade, pursue, or
evade-when-spotted).
- class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.OpponentPolicy(*values)[source]
Bases:
EnumOpponent transition behaviour selectable on the LaserTag environments.
Three policies are offered:
EVADE(default): the opponent flees the robot, placing its directional probability mass on the cell that increases distance, and reacts to the robot’s current (pre-move) position. This matches JuliaPOMDP/LaserTag.jl.PURSUE: the opponent chases the robot, placing its directional mass on the cell that decreases distance, and reacts to the robot’s post-move position. This restores the behaviour used before the evader alignment fix.EVADE_WHEN_SPOTTED: a partially-observed reactive opponent. When the robot has a clear line of sight to the opponent (the opponent lies on one of the robot’s unoccluded laser rays, evaluated from the robot’s pre-move position), it behaves exactly likeEVADE. Otherwise the unspotted behaviour is environment-specific: the discrete grid env moves randomly (uniformly over the moves, with the usual stay/wall handling), while the continuous env holds its position (only the Gaussian opponent noise jitters it). The opponent is memoryless — visibility is recomputed each step from the current state.
EVADEandPURSUEcouple both the directional choice and the reference-position choice, so they are mutually exclusive opposites.- EVADE = 'evade'
- EVADE_WHEN_SPOTTED = 'evade_when_spotted'
- PURSUE = 'pursue'
Submodules
POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.laser_tag_reward_models module
Reward models for the discrete LaserTag POMDP.
Mirrors the abstract-base / concrete-subclass layout used by
POMDPPlanners.environments.light_dark_pomdp.light_dark_pomdp_utils.light_dark_reward_models,
so that further LaserTag reward variants can be added without growing
the env class.
The reward model owns all the parameters and pre-built buffers that
the reward computation needs (walls, dangerous areas, action
directions, native-kernel cache). The environment retains its own
parameter copies for the transition / observation paths and delegates
reward() / reward_batch() to the model.
- class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.laser_tag_reward_models.BaseLaserTagRewardModel[source]
Bases:
ABCAbstract reward model for LaserTag POMDP variants.
- class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.laser_tag_reward_models.LaserTagDistanceDecayedHazardPenaltyRewardModel(floor_shape, walls, dangerous_areas, dangerous_area_radius, dangerous_area_penalty, tag_reward, tag_penalty, step_cost, action_directions, penalty_decay)[source]
Bases:
LaserTagRewardModelDangerous-area penalty fires with distance-decaying probability.
Wall hits remain deterministically penalised by
-dangerous_area_penalty. The dangerous-area contribution is-dangerous_area_penaltywith probabilityexp(-min_dist / penalty_decay)wheremin_distis the Euclidean distance from the realised position to the nearest dangerous-area centre. No radius cutoff is applied, so even faraway positions feel a (vanishingly small) penalty risk. MirrorsContinuousLightDarkDistanceDecayedHazardPenaltyRewardModel.
- class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.laser_tag_reward_models.LaserTagRewardModel(floor_shape, walls, dangerous_areas, dangerous_area_radius, dangerous_area_penalty, tag_reward, tag_penalty, step_cost, action_directions)[source]
Bases:
BaseLaserTagRewardModelStandard LaserTag reward model.
- Reward structure:
- Tag action (
4): +tag_rewardif robot and opponent occupy the same cell, otherwise-tag_penalty.
- Tag action (
Movement actions (
0..3):-step_cost.Penalty:
-dangerous_area_penaltyis subtracted whenever the realised post-action robot position is inside a wall or withindangerous_area_radiusof a dangerous-area centre.
Terminal states return
0.0reward.- Parameters:
- compute_reward(state, action, next_state=None)[source]
Return the scalar reward for
(state, action, next_state).
- compute_reward_batch(states, action, next_states=None)[source]
Vectorised reward for a batch of states under a single action.
When
next_statesis supplied the danger-area / wall penalty is evaluated against the realised positions innext_states[:, :2]. When it isNonethe legacy intended-position branch is used (state[:, :2] + action_direction), which is also what the native C++ kernel encodes. The env-side wrapper resamples a realisednext_stateswhenever walls / dangerous areas exist, so theNonebranch here is only entered when the penalty term would not fire anyway (or by callers that bypass the env wrapper).
- class POMDPPlanners.environments.laser_tag_pomdp.laser_tag_pomdp_utils.laser_tag_reward_models.LaserTagZeroMeanHazardShockRewardModel(floor_shape, walls, dangerous_areas, dangerous_area_radius, dangerous_area_penalty, tag_reward, tag_penalty, step_cost, action_directions)[source]
Bases:
LaserTagRewardModelDangerous-area penalty has zero mean and high variance.
Wall hits remain deterministically penalised by
-dangerous_area_penalty. Dangerous-area hits emit+dangerous_area_penaltyor-dangerous_area_penaltywith equal probability, mirroringContinuousLDZeroMeanHazardShockRewardModel. Walls and danger zones are scored independently — a position that is both a wall and inside a danger zone receives both contributions.