class_docstr: Defines a configuration class from which a MADDPG Algorithm can be built.
  
  Example:
      >>> from ray.rllib.algorithms.maddpg.maddpg import MADDPGConfig
      >>> config = MADDPGConfig()
      >>> print(config.replay_buffer_config)  # doctest: +SKIP
      >>> replay_config = config.replay_buffer_config.update(  # doctest: +SKIP
      ...     {
      ...         "capacity": 100000,
      ...         "prioritized_replay_alpha": 0.8,
      ...         "prioritized_replay_beta": 0.45,
      ...         "prioritized_replay_eps": 2e-6,
      ...     }
      ... )
      >>> config.training(replay_buffer_config=replay_config)   # doctest: +SKIP
      >>> config = config.resources(num_gpus=0)   # doctest: +SKIP
      >>> config = config.rollouts(num_rollout_workers=4)   # doctest: +SKIP
      >>> config = config.environment("CartPole-v1")   # doctest: +SKIP
      >>> algo = config.build()  # doctest: +SKIP
      >>> algo.train()  # doctest: +SKIP
  
  Example:
      >>> from ray.rllib.algorithms.maddpg.maddpg import MADDPGConfig
      >>> from ray import air
      >>> from ray import tune
      >>> config = MADDPGConfig()
      >>> config.training(n_step=tune.grid_search([3, 5]))  # doctest: +SKIP
      >>> config.environment(env="CartPole-v1")  # doctest: +SKIP
      >>> tune.Tuner(  # doctest: +SKIP
      ...     "MADDPG",
      ...     run_config=air.RunConfig(stop={"episode_reward_mean":200}),
      ...     param_space=config.to_dict()
      ... ).fit()
class_docstr_tok: ["Defines","a","configuration","class","from","which","a","MADDPG","Algorithm","can","be","built",".","Example",":",">",">",">","from","ray.rllib.algorithms.maddpg.maddpg","import","MADDPGConfig",">",">",">","config","=","MADDPGConfig","(",")",">",">",">","print","(","config.replay_buffer_config",")","#","doctest",":","+SKIP",">",">",">","replay_config","=","config.replay_buffer_config.update","(","#","doctest",":","+SKIP","...","{","...","``","capacity","''",":","100000",",","...","``","prioritized_replay_alpha","''",":","0.8",",","...","``","prioritized_replay_beta","''",":","0.45",",","...","``","prioritized_replay_eps","''",":","2e-6",",","...","}","...",")",">",">",">","config.training","(","replay_buffer_config=replay_config",")","#","doctest",":","+SKIP",">",">",">","config","=","config.resources","(","num_gpus=0",")","#","doctest",":","+SKIP",">",">",">","config","=","config.rollouts","(","num_rollout_workers=4",")","#","doctest",":","+SKIP",">",">",">","config","=","config.environment","(","``","CartPole-v1","''",")","#","doctest",":","+SKIP",">",">",">","algo","=","config.build","(",")","#","doctest",":","+SKIP",">",">",">","algo.train","(",")","#","doctest",":","+SKIP","Example",":",">",">",">","from","ray.rllib.algorithms.maddpg.maddpg","import","MADDPGConfig",">",">",">","from","ray","import","air",">",">",">","from","ray","import","tune",">",">",">","config","=","MADDPGConfig","(",")",">",">",">","config.training","(","n_step=tune.grid_search","(","[","3",",","5","]",")",")","#","doctest",":","+SKIP",">",">",">","config.environment","(","env=","''","CartPole-v1","''",")","#","doctest",":","+SKIP",">",">",">","tune.Tuner","(","#","doctest",":","+SKIP","...","``","MADDPG","''",",","...","run_config=air.RunConfig","(","stop=","{","``","episode_reward_mean","''",":200","}",")",",","...","param_space=config.to_dict","(",")","...",")",".fit","(",")"]
docstr: Adds the `before_learn_on_batch` hook to the config.
  
  This hook is called explicitly prior to `train_one_step()` in the
  `training_step()` methods of DQN and APEX.
docstr_tok: ["Adds","the","`","before_learn_on_batch","`","hook","to","the","config",".","This","hook","is","called","explicitly","prior","to","`","train_one_step","(",")","`","in","the","`","training_step","(",")","`","methods","of","DQN","and","APEX","."]
code: def validate(self) -> None:
      """Adds the `before_learn_on_batch` hook to the config.
  
      This hook is called explicitly prior to `train_one_step()` in the
      `training_step()` methods of DQN and APEX.
      """
      # Call super's validation method.
      super().validate()
  
      def f(batch, workers, config):
          policies = dict(
              workers.local_worker().foreach_policy_to_train(
                  lambda p, i: (i, p)
              )
          )
          return before_learn_on_batch(
              batch, policies, config["train_batch_size"]
          )
  
      self.before_learn_on_batch = f
  
file_path: ray/rllib_contrib/maddpg/src/rllib_maddpg/maddpg/maddpg.py
imports: import logging
  from typing import List, Optional, Type
  from rllib_maddpg.maddpg.maddpg_tf_policy import MADDPGTFPolicy
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.algorithms.dqn.dqn import DQN
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.deprecation import DEPRECATED_VALUE
label_desc: Use image node_id 3 for calling the MADDPGConfig obj's underlying member method code with example usage: obj.validate() and returns: before_learn_on_batch