2

Hi I am looking for an algorithm of cover given shape with other n objects. I saw some bin packing algorithms but they try to fit all objects perfectly inside the given container. In my case is like enter image description here

If someone can help me, or guide me, where I can get an information about this problem would be great.

Alex
  • 1,571
  • 3
  • 13
  • 16
  • What is known about the shape and the objects? E.g. are they all convex? – Henrik Sep 29 '16 at 13:45
  • Sorry, I don't understand what you mean by convex, sorry I m not very good in this matter. The shape would be drawn with html5 canvas so it can be circle, rectangle ect. all other objects are going to be rectangles – Alex Sep 29 '16 at 14:01

2 Answers2

1

To answer the question in part, the problem is NP-complete as it is a geometric generalization of the Partition problem. Given a list of integers {a_1,...,a_n} and a taget sum

S := ( a_1 + ... + a_n ) / 2

an instance of the problem in the question can be generated by using n rectangles of dimension

1 * a_i

for each i in {1,...,n} and a target area of size

2 * S.

The smaller rectangles can cover (which in this case is the same as fit into) the larger rectangle if and only if the instance of Partition admits a splitting into two subsets of equal total quantity.

Codor
  • 17,447
  • 9
  • 29
  • 56
1

This problem can be reduced in set cover problem very easily. link

Consider an imaginary grid plane on which these figures are drawn. Now construct a universe set U of grid squares from the big figure.

Now for each of the n small figure construct similar sets which are subsets of U. Remove extra elements from these sets which are not in U.

Now you just want the set cover for U using the n subsets you just created. If you are looking for smallest set cover, Its NP-complete.

You might want to choose some approximate solution for set cover problem.

Approximation algorithms for Set Cover

Approximating Set Cover

v78
  • 2,803
  • 21
  • 44