rllib/agents/trainer_config.py
def multi_agent(
        self,
        *,
        policies=None,
        policy_map_capacity=None,
        policy_map_cache=None,
        policy_mapping_fn=None,
        policies_to_train=None,
        observation_fn=None,
        replay_mode=None,
        count_steps_by=None,
    ) -> "TrainerConfig":
        """Sets the config's multi-agent settings.

        Args:
            policies: Map of type MultiAgentPolicyConfigDict from policy ids to tuples
                of (policy_cls, obs_space, act_space, config). This defines the
                observation and action spaces of the policies and any extra config.
            policy_map_capacity: Keep this many policies in the "policy_map" (before
                writing least-recently used ones to disk/S3).
            policy_map_cache: Where to store overflowing (least-recently used) policies?
                Could be a directory (str) or an S3 location. None for using the
                default output dir.
            policy_mapping_fn: Function mapping agent ids to policy ids.
            policies_to_train: Determines those policies that should be updated.
                Options are:
                - None, for all policies.
                - An iterable of PolicyIDs that should be updated.
                - A callable, taking a PolicyID and a SampleBatch or MultiAgentBatch
                and returning a bool (indicating whether the given policy is trainable
                or not, given the particular batch). This allows you to have a policy
                trained only on certain data (e.g. when playing against a certain
                opponent).
            observation_fn: Optional function that can be used to enhance the local
                agent observations to include more state. See
                rllib/evaluation/observation_function.py for more info.
            replay_mode: When replay_mode=lockstep, RLlib will replay all the agent
                transitions at a particular timestep together in a batch. This allows
                the policy to implement differentiable shared computations between
                agents it controls at that timestep. When replay_mode=independent,
                transitions are replayed independently per policy.
            count_steps_by: Which metric to use as the "batch size" when building a
                MultiAgentBatch. The two supported values are:
                "env_steps": Count each time the env is "stepped" (no matter how many
                multi-agent actions are passed/how many multi-agent observations
                have been returned in the previous step).
                "agent_steps": Count each individual agent step as one step.

        Returns:
            This updated TrainerConfig object.
        """
        if policies is not None:
            self.policies = policies
        if policy_map_capacity is not None:
            self.policy_map_capacity = policy_map_capacity
        if policy_map_cache is not None:
            self.policy_map_cache = policy_map_cache
        if policy_mapping_fn is not None:
            self.policy_mapping_fn = policy_mapping_fn
        if policies_to_train is not None:
            self.policies_to_train = policies_to_train
        if observation_fn is not None:
            self.observation_fn = observation_fn
        if replay_mode is not None:
            self.replay_mode = replay_mode
        if count_steps_by is not None:
            self.count_steps_by = count_steps_by

        return self
Sets the config's multi-agent settings.

        Args:
            policies: Map of type MultiAgentPolicyConfigDict from policy ids to tuples
                of (policy_cls, obs_space, act_space, config). This defines the
                observation and action spaces of the policies and any extra config.
            policy_map_capacity: Keep this many policies in the "policy_map" (before
                writing least-recently used ones to disk/S3).
            policy_map_cache: Where to store overflowing (least-recently used) policies?
                Could be a directory (str) or an S3 location. None for using the
                default output dir.
            policy_mapping_fn: Function mapping agent ids to policy ids.
            policies_to_train: Determines those policies that should be updated.
                Options are:
                - None, for all policies.
                - An iterable of PolicyIDs that should be updated.
                - A callable, taking a PolicyID and a SampleBatch or MultiAgentBatch
                and returning a bool (indicating whether the given policy is trainable
                or not, given the particular batch). This allows you to have a policy
                trained only on certain data (e.g. when playing against a certain
                opponent).
            observation_fn: Optional function that can be used to enhance the local
                agent observations to include more state. See
                rllib/evaluation/observation_function.py for more info.
            replay_mode: When replay_mode=lockstep, RLlib will replay all the agent
                transitions at a particular timestep together in a batch. This allows
                the policy to implement differentiable shared computations between
                agents it controls at that timestep. When replay_mode=independent,
                transitions are replayed independently per policy.
            count_steps_by: Which metric to use as the "batch size" when building a
                MultiAgentBatch. The two supported values are:
                "env_steps": Count each time the env is "stepped" (no matter how many
                multi-agent actions are passed/how many multi-agent observations
                have been returned in the previous step).
                "agent_steps": Count each individual agent step as one step.

        Returns:
            This updated TrainerConfig object.
        
Sets the config's multi-agent settings.
Sets the config ' s multi - agent settings .
def multi_agent(
        self,
        *,
        policies=None,
        policy_map_capacity=None,
        policy_map_cache=None,
        policy_mapping_fn=None,
        policies_to_train=None,
        observation_fn=None,
        replay_mode=None,
        count_steps_by=None,
    ) -> "TrainerConfig":
        if policies is not None:
            self.policies = policies
        if policy_map_capacity is not None:
            self.policy_map_capacity = policy_map_capacity
        if policy_map_cache is not None:
            self.policy_map_cache = policy_map_cache
        if policy_mapping_fn is not None:
            self.policy_mapping_fn = policy_mapping_fn
        if policies_to_train is not None:
            self.policies_to_train = policies_to_train
        if observation_fn is not None:
            self.observation_fn = observation_fn
        if replay_mode is not None:
            self.replay_mode = replay_mode
        if count_steps_by is not None:
            self.count_steps_by = count_steps_by
        return self
def multi_agent ( self , * , policies = None , policy_map_capacity = None , policy_map_cache = None , policy_mapping_fn = None , policies_to_train = None , observation_fn = None , replay_mode = None , count_steps_by = None , ) -> "TrainerConfig" : if policies is not None : self . policies = policies if policy_map_capacity is not None : self . policy_map_capacity = policy_map_capacity if policy_map_cache is not None : self . policy_map_cache = policy_map_cache if policy_mapping_fn is not None : self . policy_mapping_fn = policy_mapping_fn if policies_to_train is not None : self . policies_to_train = policies_to_train if observation_fn is not None : self . observation_fn = observation_fn if replay_mode is not None : self . replay_mode = replay_mode if count_steps_by is not None : self . count_steps_by = count_steps_by return self
Sets the config's multi-agent settings.
Sets the config ' s multi - agent settings .
"""Sets the config's multi-agent settings.

        Args:
            policies: Map of type MultiAgentPolicyConfigDict from policy ids to tuples
                of (policy_cls, obs_space, act_space, config). This defines the
                observation and action spaces of the policies and any extra config.
            policy_map_capacity: Keep this many policies in the "policy_map" (before
                writing least-recently used ones to disk/S3).
            policy_map_cache: Where to store overflowing (least-recently used) policies?
                Could be a directory (str) or an S3 location. None for using the
                default output dir.
            policy_mapping_fn: Function mapping agent ids to policy ids.
            policies_to_train: Determines those policies that should be updated.
                Options are:
                - None, for all policies.
                - An iterable of PolicyIDs that should be updated.
                - A callable, taking a PolicyID and a SampleBatch or MultiAgentBatch
                and returning a bool (indicating whether the given policy is trainable
                or not, given the particular batch). This allows you to have a policy
                trained only on certain data (e.g. when playing against a certain
                opponent).
            observation_fn: Optional function that can be used to enhance the local
                agent observations to include more state. See
                rllib/evaluation/observation_function.py for more info.
            replay_mode: When replay_mode=lockstep, RLlib will replay all the agent
                transitions at a particular timestep together in a batch. This allows
                the policy to implement differentiable shared computations between
                agents it controls at that timestep. When replay_mode=independent,
                transitions are replayed independently per policy.
            count_steps_by: Which metric to use as the "batch size" when building a
                MultiAgentBatch. The two supported values are:
                "env_steps": Count each time the env is "stepped" (no matter how many
                multi-agent actions are passed/how many multi-agent observations
                have been returned in the previous step).
                "agent_steps": Count each individual agent step as one step.

        Returns:
            This updated TrainerConfig object.
        """
This updated TrainerConfig object.
This updated TrainerConfig object .
self
policies
Map of type MultiAgentPolicyConfigDict from policy ids to tuples
of (policy_cls, obs_space, act_space, config). This defines the
observation and action spaces of the policies and any extra config.
Map of type MultiAgentPolicyConfigDict from policy ids to tuples of ( policy_cls obs_space act_space config ) . This defines the observation and action spaces of the policies and any extra config .
policy_map_capacity
Keep this many policies in the "policy_map" (before
writing least-recently used ones to disk/S3).
Keep this many policies in the " policy_map " ( before writing least - recently used ones to disk / S3 ) .
policy_map_cache
None
policy_mapping_fn
Function mapping agent ids to policy ids.
Function mapping agent ids to policy ids .
policies_to_train
Determines those policies that should be updated.
Options are:
None, for all policies.
An iterable of PolicyIDs that should be updated.
A callable, taking a PolicyID and a SampleBatch or MultiAgentBatch
and returning a bool (indicating whether the given policy is trainable
or not, given the particular batch). This allows you to have a policy
trained only on certain data .
Determines those policies that should be updated . Options are : None for all policies . An iterable of PolicyIDs that should be updated . A callable taking a PolicyID and a SampleBatch or MultiAgentBatch and returning a bool ( indicating whether the given policy is trainable or not given the particular batch ) . This allows you to have a policy trained only on certain data .
observation_fn
Optional function that can be used to enhance the local
agent observations to include more state. See
rllib/evaluation/observation_function.py for more info.
Optional function that can be used to enhance the local agent observations to include more state . See rllib / evaluation / observation_function . py for more info .
replay_mode
When replay_mode=lockstep, RLlib will replay all the agent
transitions at a particular timestep together in a batch. This allows
the policy to implement differentiable shared computations between
agents it controls at that timestep. When replay_mode=independent,
transitions are replayed independently per policy.
When replay_mode = lockstep RLlib will replay all the agent transitions at a particular timestep together in a batch . This allows the policy to implement differentiable shared computations between agents it controls at that timestep . When replay_mode = independent transitions are replayed independently per policy .
count_steps_by
Which metric to use as the "batch size" when building a
MultiAgentBatch. The two supported values are:
"env_steps": Count each time the env is "stepped" (no matter how many
multi-agent actions are passed/how many multi-agent observations
have been returned in the previous step).
"agent_steps": Count each individual agent step as one step.
Which metric to use as the " batch size " when building a MultiAgentBatch . The two supported values are : " env_steps " : Count each time the env is " stepped " ( no matter how many multi - agent actions are passed / how many multi - agent observations have been returned in the previous step ) . " agent_steps " : Count each individual agent step as one step .