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: Enum

Opponent 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 like EVADE. 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.

EVADE and PURSUE couple 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'
property native_code: int

Integer code passed to the C++ kernels.

EVADE = 0, PURSUE = 1, EVADE_WHEN_SPOTTED = 2.

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: ABC

Abstract reward model for LaserTag POMDP variants.

abstractmethod compute_reward(state, action, next_state=None)[source]

Return the scalar reward for (state, action, next_state).

Return type:

float

Parameters:
abstractmethod compute_reward_batch(states, action, next_states=None)[source]

Return the per-row reward for a batch of states under a single action.

Return type:

ndarray

Parameters:
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: LaserTagRewardModel

Dangerous-area penalty fires with distance-decaying probability.

Wall hits remain deterministically penalised by -dangerous_area_penalty. The dangerous-area contribution is -dangerous_area_penalty with probability exp(-min_dist / penalty_decay) where min_dist is 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. Mirrors ContinuousLightDarkDistanceDecayedHazardPenaltyRewardModel.

Parameters:
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: BaseLaserTagRewardModel

Standard LaserTag reward model.

Reward structure:
  • Tag action (4):

    +tag_reward if robot and opponent occupy the same cell, otherwise -tag_penalty.

  • Movement actions (0..3): -step_cost.

  • Penalty: -dangerous_area_penalty is subtracted whenever the realised post-action robot position is inside a wall or within dangerous_area_radius of a dangerous-area centre.

Terminal states return 0.0 reward.

Parameters:
compute_reward(state, action, next_state=None)[source]

Return the scalar reward for (state, action, next_state).

Return type:

float

Parameters:
compute_reward_batch(states, action, next_states=None)[source]

Vectorised reward for a batch of states under a single action.

When next_states is supplied the danger-area / wall penalty is evaluated against the realised positions in next_states[:, :2]. When it is None the 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 realised next_states whenever walls / dangerous areas exist, so the None branch here is only entered when the penalty term would not fire anyway (or by callers that bypass the env wrapper).

Return type:

ndarray

Parameters:
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: LaserTagRewardModel

Dangerous-area penalty has zero mean and high variance.

Wall hits remain deterministically penalised by -dangerous_area_penalty. Dangerous-area hits emit +dangerous_area_penalty or -dangerous_area_penalty with equal probability, mirroring ContinuousLDZeroMeanHazardShockRewardModel. Walls and danger zones are scored independently — a position that is both a wall and inside a danger zone receives both contributions.

Parameters: