city_lo.generate_mixed([[("a", 0)], [("a", 1), "b"]]) city_lo_seg = city.City(groups_lo, 16) city_lo_seg.generate_mixed_seg([[("a", 0)], [("a", 1), "b"]]) city_hi = city.City(groups_hi, 16) city_hi.generate_mixed([[("a", 0)], [("a", 1), "b"]]) city_hi_seg = city.City(groups_hi, 16) city_hi_seg.generate_mixed_seg([[("a", 0)], [("a", 1), "b"]]) city_all = city.City(groups_all, 16) city_all.generate_segregated() city_all_seg = city.City(groups_all, 16) city_all_seg.generate_segregated_seg() cities = [ city_no, city_no_seg, city_lo, city_lo_seg, city_hi, city_hi_seg, city_all, city_all_seg ] # cities = [city_no_seg, city_lo_seg, city_hi_seg, city_all_seg] for c in cities: print("{:.4f} {:.4f}".format(analyzer.entropy_index(c), analyzer.entropy_index(c, True))) # print(c.matrix) visualizer.plot(c)
from massey import city from massey import visualizer if __name__ == "__main__": groups0 = [group.Group("humans", 20, .5), group.Group("elves", 20, 0)] groups1 = [ group.Group("humans", 1800, .3), group.Group("elves", 600, 0), group.Group("orcs", 1200, .5) ] city0 = city.City(groups0, 5) city0.generate_segregated_seg() print(analyzer.entropy_index(city0, True)) # print(analyzer.entropy_score_city(city0, True)) # print(city0.generate_segregated()) city1 = city.City(groups1, 120) # print(city1.generate_uniform()) # print(city1.generate_segregated()) # print("") # print(city1.generate_mixed([["humans"], ["elves", "orcs"]])) # print(city1.generate_mixed_seg([["humans"], ["elves", "orcs"]])) city1.generate_mixed_seg([["humans"], ["elves", "orcs"]]) # print(analyzer.entropy_index(city1, True))