def make_world(self): world = World() # set any world properties first world.dim_c = 3 num_landmarks = 3 world.collaborative = True # add agents world.agents = [Agent() for i in range(2)] for i, agent in enumerate(world.agents): agent.name = 'agent %d' % i agent.collide = False agent.size = 0.075 # speaker world.agents[0].movable = False # listener world.agents[1].silent = True # add landmarks world.landmarks = [Landmark() for i in range(num_landmarks)] for i, landmark in enumerate(world.landmarks): landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False landmark.size = 0.04 # make initial conditions self.reset_world(world) return world
def make_world(self, **kwargs): self.before_make_world(**kwargs) world = World() world.np_random = self.np_random # set any world properties first world.dim_c = 2 num_agents = 3 num_landmarks = 3 world.collaborative = True # add agents influences = [1, 1, 1] world.agents = [Agent() for _ in range(num_agents)] for i, agent in enumerate(world.agents): agent.name = 'agent %d' % i agent.collide = True agent.silent = True agent.size = 0.15 agent.set_influence(influences[i]) self.change_entity_attribute(agent, **kwargs) # add landmarks world.landmarks = [Landmark() for _ in range(num_landmarks)] for i, landmark in enumerate(world.landmarks): landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False self.change_entity_attribute(landmark, **kwargs) # make initial conditions self.reset_world(world) return world
def make_world(self, **kwargs): self.before_make_world(**kwargs) world = World() world.np_random = self.np_random # set any world properties first world.dim_c = 3 num_landmarks = 3 world.collaborative = True # add agents world.agents = [Agent() for _ in range(2)] world.policy_agents_groups = [0, 1] for i, agent in enumerate(world.agents): agent.name = 'agent %d' % i agent.collide = False agent.size = 0.075 # speaker world.agents[0].movable = False # listener world.agents[1].silent = True # add landmarks world.landmarks = [Landmark() for _ in range(num_landmarks)] for i, landmark in enumerate(world.landmarks): landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False landmark.size = 0.04 self.change_entity_attribute(landmark, **kwargs) # make initial conditions self.reset_world(world) return world
def make_world(self, **kwargs): self.before_make_world(**kwargs) world = World() world.np_random = self.np_random # set any world properties first world.dim_c = 10 world.collaborative = True # whether agents share rewards # add agents world.agents = [Agent() for _ in range(2)] world.policy_agents_groups = [0, 0] for i, agent in enumerate(world.agents): agent.name = 'agent %d' % i agent.collide = False # add landmarks world.landmarks = [Landmark() for _ in range(3)] for i, landmark in enumerate(world.landmarks): landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False self.change_entity_attribute(landmark, **kwargs) # make initial conditions self.reset_world(world) return world
def make_world(self, N): world = World() # set any world properties first world.dim_c = 2 num_agents = N num_landmarks = 2 world.collaborative = True self.cooperative = True # generate colors: self.colors = [np.random.random(3) for _ in range(num_agents)] # add agents world.agents = [Agent() for i in range(num_agents)] for i, agent in enumerate(world.agents): agent.name = "agent_{}".format(i) agent.collide = False agent.silent = True agent.size = 0.1 agent.color = self.colors[i] # add landmarks world.landmarks = [Landmark() for i in range(num_landmarks)] self.landmark_colors = [(0, 0, 1), (1, 0, 0)] for i, landmark in enumerate(world.landmarks): landmark.size = 0.1 landmark.name = "landmark %d" % i landmark.collide = False landmark.movable = False landmark.color = self.landmark_colors[i] self.reset_world(world) return world
def make_world(self): world = World() # set any world properties first world.dim_c = 10 world.collaborative = True # whether agents share rewards # add agents world.agents = [Agent() for i in range(2)] for i, agent in enumerate(world.agents): agent.name = 'agent %d' % i agent.collide = False # add landmarks world.landmarks = [Landmark() for i in range(3)] for i, landmark in enumerate(world.landmarks): landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False # make initial conditions self.reset_world(world) return world