Skip to content

[Question] How to get the local observation of each agent? #140

@zhaoxuesi

Description

@zhaoxuesi

Required prerequisites

Questions

I copy a code that writes the get_obs() as follows. However the state = self.env.task.obs() return the global observation. However, the base_task.py only give the obs(), which reture the global obs. This mean the training and execution are conducted under centrialized-training-centrialized-execution framework. But, I want the centrialized-training-decentrialized-execution framwork. Therfore, is there any methods to get the local observation of each agent?
Here is the code (get_obs() ):
_def get_obs(self):
state = self.env.task.obs() # This is global obs.
obs_n = []
for a in range(self.num_agents):
agent_id_feats = np.zeros(self.num_agents, dtype=np.float32)
agent_id_feats[a] = 1.0
obs_i = np.concatenate([state, agent_id_feats])
obs_i = (obs_i - np.mean(obs_i)) / (np.std(obs_i) + 1e-8)
obs_n.append(obs_i)
return obs_n

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions