social_dilemmas/envs/map_env.py
def reset(self):
        """Reset the environment.

        This method is performed in between rollouts. It resets the state of
        the environment.

        Returns
        -------
        observation: dict of numpy ndarray
            the initial observation of the space. The initial reward is assumed
            to be zero.
        """
        self.beam_pos = []
        self.agents = {}
        self.setup_agents()
        self.reset_map()
        self.custom_map_update()

        map_with_agents = self.get_map_with_agents()

        observations = {}
        for agent in self.agents.values():
            agent.full_map = map_with_agents
            rgb_arr = self.color_view(agent)
            # concatenate on the prev_actions to the observations
            if self.return_agent_actions:
                # No previous actions so just pass in "wait" action
                prev_actions = np.array([4 for _ in range(self.num_agents - 1)]).astype(np.uint8)
                visible_agents = self.find_visible_agents(agent.agent_id)
                observations[agent.agent_id] = {
                    "curr_obs": rgb_arr,
                    "other_agent_actions": prev_actions,
                    "visible_agents": visible_agents,
                    "prev_visible_agents": visible_agents,
                }
                agent.prev_visible_agents = visible_agents
            else:
                observations[agent.agent_id] = {"curr_obs": rgb_arr}
        return observations
Reset the environment.

        This method is performed in between rollouts. It resets the state of
        the environment.

        Returns
        -------
        observation: dict of numpy ndarray
            the initial observation of the space. The initial reward is assumed
            to be zero.
        
Reset the environment.
This method is performed in between rollouts. It resets the state of
the environment.

Returns

dict of numpy ndarray
the initial observation of the space. The initial reward is assumed
to be zero.
Reset the environment . This method is performed in between rollouts . It resets the state of the environment . Returns dict of numpy ndarray the initial observation of the space . The initial reward is assumed to be zero .
def reset(self):
        self.beam_pos = []
        self.agents = {}
        self.setup_agents()
        self.reset_map()
        self.custom_map_update()
        map_with_agents = self.get_map_with_agents()
        observations = {}
        for agent in self.agents.values():
            agent.full_map = map_with_agents
            rgb_arr = self.color_view(agent)
            if self.return_agent_actions:
                prev_actions = np.array([4 for _ in range(self.num_agents - 1)]).astype(np.uint8)
                visible_agents = self.find_visible_agents(agent.agent_id)
                observations[agent.agent_id] = {
                    "curr_obs": rgb_arr,
                    "other_agent_actions": prev_actions,
                    "visible_agents": visible_agents,
                    "prev_visible_agents": visible_agents,
                }
                agent.prev_visible_agents = visible_agents
            else:
                observations[agent.agent_id] = {"curr_obs": rgb_arr}
        return observations
def reset ( self ) : self . beam_pos = [ ] self . agents = { } self . setup_agents ( ) self . reset_map ( ) self . custom_map_update ( ) map_with_agents = self . get_map_with_agents ( ) observations = { } for agent in self . agents . values ( ) : agent . full_map = map_with_agents rgb_arr = self . color_view ( agent ) if self . return_agent_actions : prev_actions = np . array ( [ 4 for _ in range ( self . num_agents - 1 ) ] ) . astype ( np . uint8 ) visible_agents = self . find_visible_agents ( agent . agent_id ) observations [ agent . agent_id ] = { "curr_obs" : rgb_arr , "other_agent_actions" : prev_actions , "visible_agents" : visible_agents , "prev_visible_agents" : visible_agents , } agent . prev_visible_agents = visible_agents else : observations [ agent . agent_id ] = { "curr_obs" : rgb_arr } return observations
Reset the environment.
Reset the environment .
"""Reset the environment.

        This method is performed in between rollouts. It resets the state of
        the environment.

        Returns
        -------
        observation: dict of numpy ndarray
            the initial observation of the space. The initial reward is assumed
            to be zero.
        """ # concatenate on the prev_actions to the observations # No previous actions so just pass in "wait" action
self