def make_world(self): world = World() #Setting World Properties world.dim_c = 5 num_listeners = 1 # Number of listeners= Number of agents num_speakers = 4 # Number of speakers= Number of advisors num_landmarks = 1 # Number of landmarks= Number of goals world.landmark_colors = np.array( sns.color_palette(n_colors=num_landmarks)) #Creation of listeners world.listeners = [] for listener in range(num_listeners): agent = Agent() agent.i = listener agent.name = 'agent %i' % agent.i agent.listener = True agent.collide = False agent.size = 0.075 agent.silent = True agent.accel = 1.5 agent.initial_mass = 1.0 agent.max_speed = 1.0 world.listeners.append(agent) #Creation of speakers world.speakers = [] for speaker in range(num_speakers): agent = Agent() agent.i = speaker + num_listeners agent.name = 'agent %i' % agent.i agent.listener = False agent.collide = False agent.size = 0.075 agent.movable = False agent.accel = 1.5 agent.initial_mass = 1.0 agent.max_speed = 1.0 world.speakers.append(agent) #The World is collectively made up of listeners and speakers world.agents = world.listeners + world.speakers #Creation of landmarks world.landmarks = [Landmark() for i in range(num_landmarks)] for i, landmark in enumerate(world.landmarks): landmark.i = i + num_listeners + num_speakers landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False landmark.size = 0.04 landmark.color = world.landmark_colors[i] #Set initial conditions self.reset_world(world) self.reset_cached_rewards() return world
def make_world(self): world = World() # set any world properties first world.dim_c = 5 num_listeners = 4 num_speakers = 4 num_landmarks = 6 world.landmark_colors = np.array( sns.color_palette(n_colors=num_landmarks)) world.listeners = [] for li in range(num_listeners): agent = Agent() agent.i = li agent.name = 'agent %i' % agent.i agent.listener = True agent.collide = False agent.size = 0.075 agent.silent = True agent.accel = 1.5 agent.initial_mass = 1.0 agent.max_speed = 1.0 world.listeners.append(agent) world.speakers = [] for si in range(num_speakers): agent = Agent() agent.i = si + num_listeners agent.name = 'agent %i' % agent.i agent.listener = False agent.collide = False agent.size = 0.075 agent.movable = False agent.accel = 1.5 agent.initial_mass = 1.0 agent.max_speed = 1.0 world.speakers.append(agent) world.agents = world.listeners + world.speakers # add landmarks world.landmarks = [Landmark() for i in range(num_landmarks)] for i, landmark in enumerate(world.landmarks): landmark.i = i + num_listeners + num_speakers landmark.name = 'landmark %d' % i landmark.collide = False landmark.movable = False landmark.size = 0.04 landmark.color = world.landmark_colors[i] # make initial conditions self.reset_world(world) self.reset_cached_rewards() return world