from collections import Counter import itertools import functools import operator import matplotlib.pyplot as plt from load.load import presents presents = presents() volumes = [functools.reduce(operator.mul, p.coor, 1) for p in presents] count = Counter(volumes) x, y = zip(*sorted(count.items())) plt.scatter(x, y) plt.show()
from collections import Counter import itertools import matplotlib.pyplot as plt from load.load import presents presents = presents() edges = list(tuple(sorted(p.coor)) for p in presents) SHIFT = 30 count = Counter() for i in range(len(edges)): for edge in edges[i]: for nextedge in itertools.chain.from_iterable(edges[i + 1:i + 1 + SHIFT]): count[edge + nextedge] += 1 x, y = zip(*sorted(count.items())) plt.plot(x, y) plt.show()
from maxrect_layer.maxrect_layers import MaxrectLayers from maxrect_layer.orienter3D import Orienter3D from maxrect_pack.scorer import scorerBSSF PROFILE = True SUBMISSION_FILENAME = temp("submission.csv.gz") PRIORITY_PICK = 0 USE_NUM_PRESENTS = None # None for all WIDTH = 1000 HEIGHT = 1000 if __name__ == '__main__': from load.load import Present, presents print("Starting") all_presents = presents() presents_to_place = Orienter3D.orient_all(all_presents[:USE_NUM_PRESENTS]) maxrect_layers = MaxrectLayers(WIDTH, HEIGHT, scorerBSSF, priority_pick=PRIORITY_PICK, make_timer=True, gc_collect_cycle=1000) if PROFILE: import cProfile pr = cProfile.Profile() pr.enable() maxrect_layers.solve(presents_to_place)
# from load.load import Present from load.load import Present, presents d = presents()
from maxrect_pack.scorer import scorerBSSF PROFILE = True SUBMISSION_FILENAME = temp("submission.csv.gz") PRIORITY_PICK = 0 USE_NUM_PRESENTS = None # None for all WIDTH = 1000 HEIGHT = 1000 if __name__ == '__main__': from load.load import Present, presents print("Starting") all_presents = presents() presents_to_place = Orienter3D.orient_all(all_presents[:USE_NUM_PRESENTS]) maxrect_layers = MaxrectLayers(WIDTH, HEIGHT, scorerBSSF, priority_pick=PRIORITY_PICK, make_timer=True, gc_collect_cycle=1000) if PROFILE: import cProfile pr = cProfile.Profile() pr.enable() maxrect_layers.solve(presents_to_place) pr.disable() pr.dump_stats(results("default.profile")) else: maxrect_layers.solve(presents_to_place)