Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to build custom environment with custom action space #405

Open
JustinS6626 opened this issue Sep 28, 2023 · 1 comment
Open

Comments

@JustinS6626
Copy link

Question

I have written a custom Minigrid environment recently and I am trying to modify the action space to exclude irrelevant actions. The only actions that it needs are left, right, and forward. Within the constructor of the custom environment, I do this by overwriting the action space attribute after the constructor of the base class is called. However, in some instances, such as when I make a make a wrapper for the custom environment, or when I instantiate a stable baselines PPO with the custom environment, the action spaces of the resulting objects seem to revert to the default action space with seven actions. I would really appreciate an example like the one here: https://minigrid.farama.org/content/create_env_tutorial/ with additional information on how to set a custom action space so that it never reverts to the default.

@Howuhh
Copy link

Howuhh commented Oct 18, 2023

@JustinS6626 Actually, you can just mask the irrelevant actions during training, like it usually done in PPO. For example, there is an implementation of Maskable PPO in SB3:
https://sb3-contrib.readthedocs.io/en/master/modules/ppo_mask.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants