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

support for new spaces #123

Closed
angel-ayala opened this issue Mar 29, 2023 · 2 comments
Closed

support for new spaces #123

angel-ayala opened this issue Mar 29, 2023 · 2 comments

Comments

@angel-ayala
Copy link

can you implement or give me some guidance to implement new spaces type like in Gymnasium.

There are some important spaces such as Dict and Tuple which I'm requiring.

Thanks in advance

@angel-ayala
Copy link
Author

I was looking the implementation of the Gym environment and there is a _convert_gym_space() method which transfer the Gym spaces to the Mushroom spaces code and comparing with the Discrete and Box's from Gym library.

So, I was wondering the need to do this transfer spaces because the only enhancement achieve is to store the object as Serializable. Can this be done using a wrapper adding the self._add_save_attr() method use for the respective attributes presentes in the Gym spaces?

@boris-il-forte
Copy link
Collaborator

dear @angel-ayala ,
We do this transfer of spaces because we think the Tuple and Dict environments are not well-suited for reinforcement learning state space. Thus we decided not to support these state spaces for the two following reasons:

  1. The tuple is nothing else than a finite MDP environment with coordinates. If the MDP is too big, you should not use tuples, but the Box environment (e.g. if you want a generalization in coordinates). NB: if you use tuples, you cannot solve finite MDPs using mushroom finite agents, as they use a single index to discriminate finite states. If you want to use a continuous algorithm, you can just put the tuples inside a vector using box state (the fact that the coordinates are discrete is completely irrelevant)

  2. The dict state space is irrelevant, as you can stack together the elements of the environment and create a vector.
    If you want to use dictionary output, you can simply return data using the info dictionary, which is already passed to the fit method of the environment.

Side note about gymnasium: we are still not sure when (and if) we will support it. The API of gym was breaking too much to be of any use (indeed we stopped the support at gym 0.24.1), and until gymnasium is stable and not breaking every release, we are not going to support it. However, making an interface based on the gym one is pretty trivial.

It would be instead interesting to support more complex state space, such as graphs. This requires however support for graph neural networks and a bit of software engineering, and is not planned in the short future.

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

No branches or pull requests

2 participants