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

AssertionError: The observation returned by the step() method does not match the given observation space Discrete(2) #1194

Open
lpj20 opened this issue Jun 18, 2024 · 0 comments

Comments

@lpj20
Copy link

lpj20 commented Jun 18, 2024

Hi,

I set a customized environment with a discrete type observation space. E.g.,
self.obervation_space = Dict({'A': Discrete(2), 'B': Discrete(3)})
In my action space, each value can be either +1, 0, or -1. If the next state is not contained within the designated observation space, I will apply a penalty of -10 as the reward.
But when I use check_env function to check my environment, there is an error "AssertionError: Error while checking key=A: The observation returned by the step() method does not match the given observation space Discrete(2)".
I know the problem occurs when the next state exceeds the existing designated observation space, but I would like to use the reward function to penalize the agent in such cases.
So how do I solve the problem? In other words, how do I avoid the scenario when the next state is not contained in the space?

Thank you very much.

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

1 participant