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

Multi-Action Space Reinforcement Learning #633

Open
Fornerio opened this issue Nov 19, 2024 · 1 comment
Open

Multi-Action Space Reinforcement Learning #633

Fornerio opened this issue Nov 19, 2024 · 1 comment

Comments

@Fornerio
Copy link

Hello,

I have two datasets of MDP trajectories sampled from the same environment. These datasets share the same observation, but they differ in action space.
I would like to create an offline RL model able to choose which action to perform from those two action space, but I am still doubtful on the implementation. Of course, it wouldn't make sense to create a new action space = action_space1 + action_space2.

I think that the first thing to do should be creating a new env like this

class MultiActionEnv(AbstractEnv):
    
    def __init__(self, config: dict = None) -> None:
        ...

    @classmethod
    def default_config(cls) -> dict:
        config = super().default_config()
        config.update({
            "action_first": {
                "type": action_space1
            },
            "action_second": {
                "type": action_space2
            }
        })
        return config

but I am still unsure about the changes that have to be done consequently, both in multi_action_env.py and behaviour.py/controller.py

Thank you so much in advance for your feedbacks,

Regards

@eleurent
Copy link
Collaborator

eleurent commented Dec 1, 2024

I don't think the environment needs to be MultiAgent, the best is to implement your own ActionType and use a composite action space, see https://gymnasium.farama.org/api/spaces/composite/

For example,

observation_space = Dict({
  "selected_action_space": Discrete(2), 
  "action_space_1": Box(-1, 1, shape=(2,)),
  "action_space_2": Discrete(10),
}, seed=42)

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