PowerPenalty
- class fluidgym.wrappers.power_penalty.PowerPenalty(env: FluidEnvLike, penalty: float)[source]
Bases:
FluidWrapperCharge the reward for actuation power as
reward - penalty * ||action||^2.- Parameters:
env (FluidEnvLike) – The environment to wrap.
penalty (float) – The coefficient scaling the squared L2 norm of the action.
- step(action: Tensor) tuple[dict[str, Tensor], Tensor, bool | Tensor, bool | Tensor, dict[str, Tensor]][source]
Run one timestep of the environment’s dynamics using the agent actions.
When the end of an episode is reached (
terminated or truncated), it is necessary to callreset()to reset this environment’s state for the next episode.- Parameters:
action (torch.Tensor) – The action to take.
- Returns:
tuple[
dict[str, torch.Tensor], torch.Tensor, bool, bool, dict[str, torch.Tensor]] – A tuple containing the observation, reward, terminated flag, truncated flag, and info dictionary.