From bdf1404a5f72a145f1f0e203daf074605851ef0a Mon Sep 17 00:00:00 2001 From: Sven Mika Date: Tue, 16 Jun 2020 08:50:53 +0200 Subject: [PATCH] [RLlib] Issue 8714: QMIX init error w/ tuple obs space. (#8936) --- rllib/agents/qmix/qmix_policy.py | 1 + rllib/tests/test_avail_actions_qmix.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/rllib/agents/qmix/qmix_policy.py b/rllib/agents/qmix/qmix_policy.py index 5e82880dd..2d821da9c 100644 --- a/rllib/agents/qmix/qmix_policy.py +++ b/rllib/agents/qmix/qmix_policy.py @@ -194,6 +194,7 @@ class QMixTorchPolicy(Policy): agent_obs_space = agent_obs_space.spaces["obs"] else: self.obs_size = _get_size(agent_obs_space) + self.env_global_state_shape = (self.obs_size, self.n_agents) self.model = ModelCatalog.get_model_v2( agent_obs_space, diff --git a/rllib/tests/test_avail_actions_qmix.py b/rllib/tests/test_avail_actions_qmix.py index ecda166d8..5576deebf 100644 --- a/rllib/tests/test_avail_actions_qmix.py +++ b/rllib/tests/test_avail_actions_qmix.py @@ -78,6 +78,8 @@ class TestAvailActionsQMix(unittest.TestCase): for _ in range(5): agent.train() # OK if it doesn't trip the action assertion error assert agent.train()["episode_reward_mean"] == 21.0 + agent.stop() + ray.shutdown() if __name__ == "__main__":