def test_maddpg_compilation(self): """Test whether MADDPG can be built with all frameworks.""" config = (maddpg.MADDPGConfig().environment( env=TwoStepGame, env_config={ "actions_are_logits": True, }, ).multi_agent( policies={ "pol1": PolicySpec(config={"agent_id": 0}, ), "pol2": PolicySpec(config={"agent_id": 1}, ), }, policy_mapping_fn=lambda aid, **kwargs: "pol2" if aid else "pol1", )) num_iterations = 1 # Only working for tf right now. for _ in framework_iterator(config, frameworks="tf"): algo = config.build() for i in range(num_iterations): results = algo.train() check_train_results(results) print(results) algo.stop()
def _import_maddpg(): import ray.rllib.algorithms.maddpg as maddpg return maddpg.MADDPG, maddpg.MADDPGConfig().to_dict()