code: def test_multi_agent(self):
      register_env(
          "multi_agent_cartpole",
          lambda _: MultiAgentCartPole({"num_agents": 10}),
      )
  
      config = (
          PGConfig()
          .environment("multi_agent_cartpole")
          .rollouts(num_rollout_workers=0)
          .multi_agent(
              policies={"policy_1", "policy_2"},
              policy_mapping_fn=lambda agent_id, episode, worker, **kwargs: (
                  random.choice(["policy_1", "policy_2"])
              ),
          )
      )
  
      for fw in framework_iterator(config):
          config.offline_data(output=self.test_dir + fw)
          algo = config.build()
          algo.train()
          self.assertEqual(len(os.listdir(self.test_dir + fw)), 1)
          algo.stop()
  
          config2 = config.copy()
          config2.output = None
          config2.evaluation(
              evaluation_interval=1,
              evaluation_config=PPOConfig.overrides(input_="sampler"),
          )
          config2.training(train_batch_size=2000)
          config2.offline_data(input_=self.test_dir + fw)
  
          algo2 = config2.build()
          result = algo2.train()
          assert np.isnan(
              result["episode_reward_mean"]
          ), "episode reward should not be computed for offline data"
          assert not np.isnan(
              result["evaluation"]["episode_reward_mean"]
          ), "Did not see simulation results during evaluation"
          algo2.stop()
  
imports: import glob
  import json
  import numpy
  import os
  import random
  import shutil
  import tempfile
  import unittest
  import ray
  from ray.tune.registry import register_env, register_input, registry_get_input, registry_contains_input
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
  from ray.rllib.algorithms.pg import PGConfig
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
  from ray.rllib.offline import IOContext, JsonWriter, JsonReader, InputReader, ShuffledInput, DatasetWriter
  from ray.rllib.offline.json_reader import from_json_data
  from ray.rllib.offline.json_writer import _to_json_dict, _to_json
  from ray.rllib.policy.sample_batch import SampleBatch, convert_ma_batch_to_sample_batch
  from ray.rllib.utils.test_utils import framework_iterator
label_desc: Use image node_id 13 for calling the AgentIOTest obj's underlying member method code with example usage: obj.test_multi_agent() without return types