Exemplo n.º 1
0
 def get_incomplete_episodes(self,
                             threshold_step_count: int = 30,
                             agent_name: str = "prey") -> JsonList:
     incomplete_episodes = JsonList(list_type=int)
     for i, episode in enumerate(self.episodes):
         agent_trajectory = episode.trajectories.get_agent_trajectory(
             agent_name)
         if len(agent_trajectory) == 0:
             continue
         if len(agent_trajectory) < threshold_step_count:
             incomplete_episodes.append(i)
     return incomplete_episodes
Exemplo n.º 2
0
 def get_broken_trajectory_episodes(self,
                                    threshold_distance: float = .1,
                                    agent_name: str = "prey") -> JsonList:
     broken_trajectory_episodes = JsonList(list_type=int)
     for i, episode in enumerate(self.episodes):
         agent_trajectory = episode.trajectories.get_agent_trajectory(
             agent_name)
         last_location = None
         for step in agent_trajectory:
             if last_location is not None:
                 if last_location.dist(step.location) > threshold_distance:
                     broken_trajectory_episodes.append(i)
                     break
             last_location = step.location
     return broken_trajectory_episodes
Exemplo n.º 3
0
 def get_wrong_goal_episodes(self,
                             goal: Coordinates = Coordinates(20, 0),
                             agent_name: str = "prey") -> JsonList:
     world = World.get_from_parameters_names(self.world_configuration_name,
                                             "canonical")
     wrong_goal_episodes = JsonList(list_type=int)
     for i, episode in enumerate(self.episodes):
         agent_trajectory = episode.trajectories.get_agent_trajectory(
             agent_name)
         if len(agent_trajectory) == 0:
             continue
         episode_goal_location = agent_trajectory[-1].location
         episode_goal_index = world.cells.find(episode_goal_location)
         episode_goal_coordinates = world.cells[
             episode_goal_index].coordinates
         if not episode_goal_coordinates == goal:
             wrong_goal_episodes.append(i)
     return wrong_goal_episodes