Ejemplo n.º 1
0
 def test_fixed_plan_agents(self):
     a0 = FixedPlanAgent([s, e, n, w])
     a1 = FixedPlanAgent([s, w, n, e])
     agent_pair = AgentPair(a0, a1)
     env = OvercookedEnv.from_mdp(large_mdp, horizon=10)
     trajectory, time_taken, _, _ = env.run_agents(agent_pair, include_final_state=True, display=DISPLAY)
     end_state = trajectory[-1][0]
     self.assertEqual(time_taken, 10)
     self.assertEqual(env.mdp.get_standard_start_state().player_positions, end_state.player_positions)
Ejemplo n.º 2
0
 def test_four_player_env_fixed(self):
     mdp = OvercookedGridworld.from_layout_name("multiplayer_schelling")
     assert mdp.num_players == 4
     env = OvercookedEnv.from_mdp(mdp, horizon=16)
     a0 = FixedPlanAgent([stay, w, w])
     a1 = FixedPlanAgent([stay, stay, e, e, n, n, n, e, interact, n, n, w, w, w, n, interact, e])
     a2 = FixedPlanAgent([stay, w, interact, n, n, e, e, e, n, e, n, interact, w])
     a3 = FixedPlanAgent([e, interact, n, n, w, w, w, n, interact, e, s])
     ag = AgentGroup(a0, a1, a2, a3)
     env.run_agents(ag, display=False)
     self.assertEqual(
         env.state.players_pos_and_or,
         (((1, 1), (-1, 0)), ((3, 1), (0, -1)), ((2, 1), (-1, 0)), ((4, 2), (0, 1)))
     )
Ejemplo n.º 3
0
 def test_one_player_env(self):
     mdp = OvercookedGridworld.from_layout_name("cramped_room_single")
     env = OvercookedEnv(mdp, horizon=12)
     a0 = FixedPlanAgent([stay, w, w, e, e, n, e, interact, w, n, interact])
     ag = AgentGroup(a0)
     env.run_agents(ag, display=False)
     self.assertEqual(env.state.players_pos_and_or, (((2, 1), (0, -1)), ))
Ejemplo n.º 4
0
 def test_one_coupled_one_fixed(self):
     a0 = CoupledPlanningAgent(self.mlp_large)
     a1 = FixedPlanAgent([s, e, n, w])
     agent_pair = AgentPair(a0, a1)
     env = OvercookedEnv.from_mdp(large_mdp, horizon=10)
     trajectory, time_taken, _, _ = env.run_agents(agent_pair,
                                                   include_final_state=True,
                                                   display=DISPLAY)
     self.assertEqual(time_taken, 10)
Ejemplo n.º 5
0
 def setUp(self):
     self.base_mdp = OvercookedGridworld.from_layout_name("cramped_room")
     self.env = OvercookedEnv(self.base_mdp, **DEFAULT_ENV_PARAMS)
     self.rnd_agent_pair = AgentPair(FixedPlanAgent([]), FixedPlanAgent([]))
     np.random.seed(0)
Ejemplo n.º 6
0
 def setUp(self):
     self.base_mdp = OvercookedGridworld.from_layout_name("simple")
     self.env = OvercookedEnv(self.base_mdp, **DEFAULT_ENV_PARAMS)
     self.rnd_agent_pair = AgentPair(FixedPlanAgent([stay, w, w]),
                                     FixedPlanAgent([stay, e, e]))
     np.random.seed(0)