Fill arbitrary 2D shape with given set of rectangles

前端 未结 3 1724
自闭症患者
自闭症患者 2020-12-02 16:03

I have a set of rectangles and arbitrary shape in 2D space. The shape is not necessary a polygon (it may be a circle), and rectangles have different widths and heights. The

3条回答
  •  日久生厌
    2020-12-02 16:38

    I think this problem is suitable for solving with genetic algorithm and/or evolutionary strategy algorithm. I've done similar box packing problem with the help of evolutionary strategy algorithm of some kind. Check this out in my blog.

    So if you will use such approach - encode into chromosomes box:

    • x coordinate
    • y coordinate
    • angle

    Then try to minimize such fitness function-

    y = w1 * box_intersection_area + w2 * box_area_out_of_shape + w3 * average_circle_radius_in_free_space

    Choose weights w1,w2,w3 such as to affect importance of factors. When genetic algorithm will find partial solution - remove boxes which still overlaps together or are out of shape - and you will have at least legal (but not necessary optimal) solution.

    good luck in this interesting problem !

提交回复
热议问题