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] agent_obsk in mujoco_multi.py #227

Open
xihuai18 opened this issue Sep 28, 2024 · 4 comments · May be fixed by #228
Open

[Question] agent_obsk in mujoco_multi.py #227

xihuai18 opened this issue Sep 28, 2024 · 4 comments · May be fixed by #228

Comments

@xihuai18
Copy link

Question

agent_obsk: Number of nearest joints to observe,
If set to 0 it only observes local state,
If set to 1 it observes local state + 1 joint over,
If set to 2 it observes local state + 2 joints over,
If it set to None the task becomes single agent (the agent observes the entire environment, and performs all the actions)
The Default value is: 1

agent_obsk in the original repo controls only the observation construction, but not the action factorization. I am wondering why implementing agent 0 performs all the actions when agent_obsk is None here.

@Kallinteris-Andreas
Copy link
Collaborator

Kallinteris-Andreas commented Sep 28, 2024

@xihuai18
Copy link
Author

I think the main difference is

https://github.com/schroederdewitt/multiagent_mujoco/blob/b212ddd74b258e7cea006ff1d642b5ffada4b99d/multiagent_mujoco/mujoco_multi.py#L108-L116

and

if self.agent_obsk is None:
return actions[self.possible_agents[0]]

In the original repo, the final action to use is constructed by multiple agents, while the final action is decided by the first agent in this repo, when agent_obsk == None.

@xihuai18
Copy link
Author

I make a PR #228 and pass my tests in https://github.com/xihuai18/MaMuJoCo-PettingZoo/blob/main/tests/mamujoco_pettingzoo_v1_test.py, I think these changes make the current implementation perform the same behavior as the original repo.

@Kallinteris-Andreas
Copy link
Collaborator

Kallinteris-Andreas commented Sep 29, 2024

  1. Can you provide an example of the behavior of agent_obsk=None when using the original implementation
>>> import gymnasium_robotics         
>>> from gymnasium_robotics import mamujoco_v1
>>> env = mamujoco_v1.parallel_env("Ant", "2x4", agent_obsk=None)
>>> env.action_spaces
{'agent_0': Box(-1.0, 1.0, (8,), float32)}
>>> env.observation_spaces
{'agent_0': Box(-inf, inf, (105,), float64)}
  1. regardless of (1.), what is the reason you want fully observable multi-agent factorizations of the environments, this is equivalent to a single agent environment, with extra steps (https://discord.com/channels/765294874832273419/808462033866588180/1261698405630214185 )

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

Successfully merging a pull request may close this issue.

2 participants