rllib/env/multi_agent_env.py
def action_space_sample(self, agent_ids: list = None) -> MultiAgentDict:
        """Returns a random action for each environment, and potentially each
            agent in that environment.

        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.action_space.sample()
            return {
                agent_id: samples[agent_id]
                for agent_id in agent_ids
                if agent_id != "__all__"
            }
        logger.warning("action_space_sample() has not been implemented")
        return {}
Returns a random action for each environment, and potentially each
            agent in that environment.

        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 action for each environment, and potentially each
agent in that environment.
Returns a random action for each environment and potentially each agent in that environment .
def action_space_sample(self, agent_ids: list = None) -> MultiAgentDict:
        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.action_space.sample()
            return {
                agent_id: samples[agent_id]
                for agent_id in agent_ids
                if agent_id != "__all__"
            }
        logger.warning("action_space_sample() has not been implemented")
        return {}
def action_space_sample ( self , agent_ids : list = None ) -> MultiAgentDict : 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 . action_space . sample ( ) return { agent_id : samples [ agent_id ] for agent_id in agent_ids if agent_id != "__all__" } logger . warning ( "action_space_sample() has not been implemented" ) return { }
Returns a random action for each environment, and potentially each
agent in that environment.
Returns a random action for each environment and potentially each agent in that environment .
"""Returns a random action for each environment, and potentially each
            agent in that environment.

        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 .