DHC icon indicating copy to clipboard operation
DHC copied to clipboard

Unreachable agent targets might be generated.

Open Apolsus opened this issue 2 years ago • 0 comments

        # ... line 175 at file enviorment.py
        for i in range(self.num_agents):

            pos_idx = random.randint(0, pos_num - 1)
            partition_idx = 0
            for partition in partition_list:
                if pos_idx >= len(partition):
                    pos_idx -= len(partition)
                    partition_idx += 1
                else:
                    break

            pos = random.choice(partition_list[partition_idx])
            partition_list[partition_idx].remove(pos)
            self.agents_pos[i] = np.asarray(pos, dtype=np.int)

            pos = random.choice(partition_list[partition_idx])
            partition_list[partition_idx].remove(pos)
            self.goals_pos[i] = np.asarray(pos, dtype=np.int)

            partition_list = [partition for partition in partition_list if len(partition) >= 2]
            pos_num = sum([len(partition) for partition in partition_list])

This might not be a right way to generate positions for the agents. Because the connectivity of the partition may be disrupted after the addition of the agents. Which may generate unreachable agent targets. image

Apolsus avatar Mar 21 '22 00:03 Apolsus