LBForagingEnv#
- torchrl.envs.LBForagingEnv(*args, **kwargs)[source]#
Level-Based Foraging environment wrapper, constructed from an environment name.
See
LBForagingWrapperfor a description of the environment and the tensordict layout it produces.- Parameters:
env_name (str) – the name of a registered Level-Based Foraging Gymnasium environment, e.g.
"Foraging-8x8-2p-3f-v3"(an 8x8 grid, 2 players, 3 food items). Seeavailable_envsfor the full list.- Keyword Arguments:
categorical_actions (bool, optional) – whether discrete actions should be provided as categorical indices or one-hot encodings. Defaults to
True.seed (int, optional) – the seed to use to reset the environment on the first call to
reset(). Defaults toNone.**kwargs – forwarded to
gymnasium.make.
Examples
>>> from torchrl.envs.libs.lbforaging import LBForagingEnv >>> env = LBForagingEnv("Foraging-8x8-2p-3f-v3", categorical_actions=False) >>> rollout = env.rollout(3)