Пример #1
0
 def _generate_reset_input(self) -> UnityInputProto:
     rl_in = UnityRLInputProto()
     rl_in.command = RESET
     rl_in.side_channel = bytes(
         self._side_channel_manager.generate_side_channel_messages()
     )
     return self._wrap_unity_input(rl_in)
Пример #2
0
 def _generate_step_input(
     self, vector_action: Dict[str, ActionTuple]
 ) -> UnityInputProto:
     rl_in = UnityRLInputProto()
     for b in vector_action:
         n_agents = len(self._env_state[b][0])
         if n_agents == 0:
             continue
         for i in range(n_agents):
             action = AgentActionProto()
             if vector_action[b].continuous is not None:
                 action.vector_actions_deprecated.extend(
                     vector_action[b].continuous[i]
                 )
                 action.continuous_actions.extend(vector_action[b].continuous[i])
             if vector_action[b].discrete is not None:
                 action.vector_actions_deprecated.extend(
                     vector_action[b].discrete[i]
                 )
                 action.discrete_actions.extend(vector_action[b].discrete[i])
             rl_in.agent_actions[b].value.extend([action])
             rl_in.command = STEP
     rl_in.side_channel = bytes(
         self._side_channel_manager.generate_side_channel_messages()
     )
     return self._wrap_unity_input(rl_in)
Пример #3
0
 def _generate_step_input(
         self, vector_action: Dict[str, np.ndarray]) -> UnityInputProto:
     rl_in = UnityRLInputProto()
     for b in vector_action:
         n_agents = len(self._env_state[b][0])
         if n_agents == 0:
             continue
         for i in range(n_agents):
             action = AgentActionProto(vector_actions=vector_action[b][i])
             rl_in.agent_actions[b].value.extend([action])
             rl_in.command = STEP
     rl_in.side_channel = bytes(
         self._generate_side_channel_data(self.side_channels))
     return self.wrap_unity_input(rl_in)
Пример #4
0
 def _generate_reset_input(self) -> UnityInputProto:
     rl_in = UnityRLInputProto()
     rl_in.command = RESET
     rl_in.side_channel = bytes(
         self._generate_side_channel_data(self.side_channels))
     return self.wrap_unity_input(rl_in)