docstr: Tests simple extension of single-agent to independent multi-agent case.
docstr_tok: ["Tests","simple","extension","of","single-agent","to","independent","multi-agent","case","."]
code: def test_bc_algorithm_marl(self):
      """Tests simple extension of single-agent to independent multi-agent case."""
  
      policies = {"policy_1", "policy_2"}
      config = (
          BCConfigTest()
          .experimental(_enable_new_api_stack=True)
          .training(model={"fcnet_hiddens": [32, 32]})
          .multi_agent(
              policies=policies,
              policy_mapping_fn=lambda agent_id, **kwargs: list(
                  policies
              )[agent_id],
          )
          .environment(MultiAgentCartPole, env_config={"num_agents": 2})
      )
  
      # TODO (Kourosh): Add tf2 support
      for fw in framework_iterator(config, frameworks=("torch")):
          algo = config.build()
          for policy_id in policies:
              policy = algo.get_policy(policy_id=policy_id)
              rl_module = policy.model
  
              if fw == "torch":
                  assert isinstance(rl_module, DiscreteBCTorchModule)
              elif fw == "tf2":
                  assert isinstance(rl_module, DiscreteBCTFModule)
  
file_path: ray/rllib/core/testing/tests/test_bc_algorithm.py
imports: import unittest
  import gymnasium
  import ray
  from ray.rllib.core.testing.torch.bc_module import DiscreteBCTorchModule, BCTorchRLModuleWithSharedGlobalEncoder, BCTorchMultiAgentModuleWithSharedEncoder
  from ray.rllib.core.testing.tf.bc_module import DiscreteBCTFModule, BCTfRLModuleWithSharedGlobalEncoder, BCTfMultiAgentModuleWithSharedEncoder
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec
  from ray.rllib.core.rl_module.marl_module import MultiAgentRLModuleSpec
  from ray.rllib.core.testing.bc_algorithm import BCConfigTest
  from ray.rllib.utils.test_utils import framework_iterator
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
label_desc: Use image node_id 4 for calling the TestLearner obj's underlying member method code with example usage: obj.test_bc_algorithm_marl() without return types