rllib/env/multi_agent_env.py
def observation_space_sample(self, agent_ids: list = None) -> MultiEnvDict:
        """Returns a random observation from the observation space for each
        agent if agent_ids is None, otherwise returns a random observation for
        the agents in agent_ids.

        Args:
            agent_ids: List of agent ids to sample actions for. If None or
                empty list, sample actions for all agents in the
                environment.

        Returns:
            A random action for each environment.
        """

        if (
            not hasattr(self, "_spaces_in_preferred_format")
            or self._spaces_in_preferred_format is None
        ):
            self._spaces_in_preferred_format = (
                self._check_if_space_maps_agent_id_to_sub_space()
            )
        if self._spaces_in_preferred_format:
            if agent_ids is None:
                agent_ids = self.get_agent_ids()
            samples = self.observation_space.sample()
            samples = {agent_id: samples[agent_id] for agent_id in agent_ids}
            return samples
        logger.warning("observation_space_sample() has not been implemented")
        return {}
Returns a random observation from the observation space for each
        agent if agent_ids is None, otherwise returns a random observation for
        the agents in agent_ids.

        Args:
            agent_ids: List of agent ids to sample actions for. If None or
                empty list, sample actions for all agents in the
                environment.

        Returns:
            A random action for each environment.
        
Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids.
Returns a random observation from the observation space for each agent if agent_ids is None otherwise returns a random observation for the agents in agent_ids .
def observation_space_sample(self, agent_ids: list = None) -> MultiEnvDict:
        if (
            not hasattr(self, "_spaces_in_preferred_format")
            or self._spaces_in_preferred_format is None
        ):
            self._spaces_in_preferred_format = (
                self._check_if_space_maps_agent_id_to_sub_space()
            )
        if self._spaces_in_preferred_format:
            if agent_ids is None:
                agent_ids = self.get_agent_ids()
            samples = self.observation_space.sample()
            samples = {agent_id: samples[agent_id] for agent_id in agent_ids}
            return samples
        logger.warning("observation_space_sample() has not been implemented")
        return {}
def observation_space_sample ( self , agent_ids : list = None ) -> MultiEnvDict : if ( not hasattr ( self , "_spaces_in_preferred_format" ) or self . _spaces_in_preferred_format is None ) : self . _spaces_in_preferred_format = ( self . _check_if_space_maps_agent_id_to_sub_space ( ) ) if self . _spaces_in_preferred_format : if agent_ids is None : agent_ids = self . get_agent_ids ( ) samples = self . observation_space . sample ( ) samples = { agent_id : samples [ agent_id ] for agent_id in agent_ids } return samples logger . warning ( "observation_space_sample() has not been implemented" ) return { }
Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids.
Returns a random observation from the observation space for each agent if agent_ids is None otherwise returns a random observation for the agents in agent_ids .
"""Returns a random observation from the observation space for each
        agent if agent_ids is None, otherwise returns a random observation for
        the agents in agent_ids.

        Args:
            agent_ids: List of agent ids to sample actions for. If None or
                empty list, sample actions for all agents in the
                environment.

        Returns:
            A random action for each environment.
        """
A random action for each environment.
A random action for each environment .
self
agent_ids
list
List of agent ids to sample actions for. If None or
empty list, sample actions for all agents in the
environment.
List of agent ids to sample actions for . If None or empty list sample actions for all agents in the environment .