def decode_geometry_msg(request_geometries): product_boxes = [] for sp in request_geometries: product_boxes.append( Cuboid(Point(sp.dimensions)) ) return product_boxes
def __calculate_genetic_parameters(parameters: dict, num_items: int): parameters['population_size'] = parameters['population_factor'] * num_items parameters['num_elites'] = int(parameters['elites_percentage'] * parameters['population_size']) parameters['num_mutants'] = int(parameters['mutants_percentage'] * parameters['population_size']) if parameters['delivery_bin_spec'] is None: parameters['delivery_bin_spec'] = [30, 30, 30] parameters['delivery_bin_spec'] = Cuboid( Point(np.array(parameters['delivery_bin_spec']))) return parameters
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()
def __init__(self, container_spec: Cuboid): self.container_spec = container_spec self.container_upper_right = Point( self.container_spec.dimensions.coords)