def read_csv_data(file="data/product_boxes.csv"):
    product_boxes = []
    with open(file, 'r') as csvfile:
        reader = csv.DictReader(csvfile, delimiter=',')
        for row in reader:
            count = int(row['count'])
            index = 0
            while index < count:
                product_boxes.append(
                    Cuboid(
                        Point.from_scalars(int(row['width']),
                                           int(row['depth']),
                                           int(row['height']))))
                index += 1
    return product_boxes
示例#2
0
                        float(placement_solution.box_id) /
                        len(delivery_bins[del_bin]),
                        float(placement_solution.box_id) /
                        len(delivery_bins[del_bin]), 1))
    plt.show()


def plot_placements(container_bin, placements, plot_spaces=False):
    g = plot_container(container_bin)
    for i, product_placement in enumerate(placements):
        if product_placement:
            draw_placement(g, product_placement,
                           ((float(i + 1) / len(placements)), 0, 0, 0))
    if plot_spaces:
        for empty_space in container_bin.empty_space_list:
            if empty_space:
                draw_space(g, empty_space, empty_color)
    plt.show()


if __name__ == '__main__':
    spec = Cuboid(Point.from_scalars(30, 30, 30))
    container_ = Container(spec)
    g = plot_container(container_)
    g.view_init(elev=30., azim=60)
    b = Point(np.array([5, 5, 5]))
    d = Point(np.array([3, 2, 3]))
    s = Space(d, b)
    draw_space(g, s, product_color)
    plt.show()