def main(): for agents_attributes in json.load( open("agents-100k.json")): #read from json file longitude = agents_attributes.pop('longitude') latitude = agents_attributes.pop('latitude') pos = Position(longitude, latitude) # create a new position for every agent agent = Agent(pos, **agents_attributes) # create the agent zone = Zone.find_zone_that_contains( pos) # find the zone in which the agent exist zone.add_inhabitant(agent) # add the agent in this zone agreeableness_graph = AgreeablenessGraph() # initialise the graph agreeableness_graph.show(Zone.ZONES)
def main(): # Load agents for agent_properties in json.load(open("agents-100k.json")): longitude = agent_properties.pop('longitude') latitude = agent_properties.pop('latitude') # store agent position in radians position = Position(longitude, latitude) zone = Zone.find_zone_that_contains(position) agent = Agent(position, **agent_properties) zone.add_inhabitant(agent) agreeableness_graph = AgreeablenessGraph() agreeableness_graph.show(Zone.ZONES) income_graph = IncomeGraph() income_graph.show(Zone.ZONES)