5

This is a homework assignment, so any help is appreciated.

I should prove that the following problem is NP-complete. The hint says that you should reduce the subset sum problem to this problem.

Given a set of shapes, like the below, and an m-by-n board, decide whether is it possible to cover the board fully with all the shapes. Note that the shapes may not rotate.

For example, for a 3-by-5 board and the following pieces, the board can be covered like this:

shapes

covered board

Now the important thing to note is that the subset sum problem we are trying to reduce should be given input length polynomial in terms of m and n.

Any ideas for using another NP-complete problem are appreciated.

Community
  • 1
  • 1
Ashkan Kazemi
  • 1,077
  • 8
  • 26
  • Could you please state what the original problem is? What is the question - prove that answering whether or not you can cover the board is NP-complete? that you can't? – shapiro yaacov Jun 01 '15 at 14:03
  • @shapiro.yaacov do you need more clarification? becuase i think the question is clear enough. is there any special point that you want to know? – Ashkan Kazemi Jun 01 '15 at 14:05
  • 1. I would like to know the original question. 2. Try looking at the Wang Tile problem (not a full answer, I agree). 3. To me, at least, it sounds that you state the problem as "say that is it possible to cover the board fully with all the shapes". So this is a show a way or state it is/isn't possible question? – shapiro yaacov Jun 01 '15 at 14:14
  • 1
    This is not a good question for Stack Overflow. – Nick Jun 01 '15 at 14:16
  • @shapiro.yaacov first of all, yes it is described as a decision problem, and for proving the np completeness of any problem we should describe it as a decision problem first. the original question is exactly said in the question, and it is in another language so i cannot post the original one here. I saw that problem, but it needs work, but it was a good pointer, thanks! – Ashkan Kazemi Jun 01 '15 at 14:17
  • @Nick before posting the question I checked the np-complete tag and subset sum tag and I saw similar questions, that was the reason i posted this here. – Ashkan Kazemi Jun 01 '15 at 14:18
  • Hint: To do the reduction, you need to somehow turn an instance of Subset Sum into an instance of this problem. So, is there an obvious way to turn an individual number from the SS problem into something in this problem? What happens if you follow this train of thought? – j_random_hacker Jun 01 '15 at 15:23
  • 1
    @j_random_hacker im actually exactly doing this. A simple way is to have a board of size 1*s ( the sum number ) for the sum and each number gets i blocks, and then try to cover the board with the blocks. the problem is, this is not polynomial reduction! – Ashkan Kazemi Jun 01 '15 at 17:47
  • http://en.wikipedia.org/wiki/Polyomino#Tiling_regions_with_sets_of_polyominoes (not the same, but relevant) – Veedrac Jun 01 '15 at 23:31
  • Something is missing... What you are telling me implies that the set of pieces (and in particular, their individual shapes) is *not* part of the problem. I see two possibilities: Either the set of pieces is fixed (i.e., fixed across all problem instances -- e.g., to the set of 4 blocks in your example), *or* the set of pieces forms part of the problem instance, in which case the reduction idea I suggested should be fine. – j_random_hacker Jun 02 '15 at 10:27
  • @j_random_hacker how did I imply the set of pieces are fixed!? of course they are part of the problem. – Ashkan Kazemi Jun 03 '15 at 04:38
  • @Veedrac actually the problem you suggested is undecideable, which means its not np-complete, its harder than that! – Ashkan Kazemi Jun 03 '15 at 04:40
  • My comment containing the correct answer has been deleted, presumably because someone was offended by my telling the OP to show some appreciation for the help being offered. Remarkable. – j_random_hacker Jun 04 '15 at 08:21
  • @j_random_hacker your comment neither contained an answer nor was anything near appropriate. – Ashkan Kazemi Jun 04 '15 at 08:33
  • My comment spelled out *the* answer, and I picked a tone to match the tone of your preceding comment to me. – j_random_hacker Jun 04 '15 at 08:59
  • I have an answer that would take more effort to write than I'm willing to expend. In case it helps, the key is using the Chinese Remainder Theorem to reduce a subset sum of size N to O(N) modular subset sums of size O(log N). You have to use various lock-and-key tricks to ensure the same subset is selected for all moduli, etc. It seems too complex for homework, so there's probably a simpler way. – Matt Timmermans Dec 22 '20 at 22:30

2 Answers2

1

The easiest reduction is from the partition problem.

Suppose that we have a set of positive numbers that sum to 2n and we want to know a subset of them sums to n.

We create a set of blocks of length the numbers and width 1, then try to fit them into a rectangle of width 2 and length n. We can succeed if and only if the partition problem was solvable for those numbers, and the rows are the partition. So any partition problem can be reduced to a polyomino packing problem in linear time. Since the partition problem is NP-complete, we are done.

But they said subset sum. If they mean subset sum on positive numbers, then we can just use another trick. Suppose that our numbers sum to n and we want to know if a subset sums to k. Then we just add 2 numbers to the problem of size k+1 and size n-k+1 and aim to solve the partition problem. If we succeed, our additional 2 numbers couldn't have been in the same partition and so the rest are a solution to the partition problem. Since we've already reduced the partition problem to polyomino packing problem, we are done.

If they intended subset sum from numbers that can be both positive and negative, then I don't see the reduction that they suggested. But since I've managed to reduce 2 well-known NP-complete problems to this one, I think we're good.

btilly
  • 43,296
  • 3
  • 59
  • 88
0

subset sum reduction

Like btilly said we create a set of block of length of the numbers and width 1 with one additional helper piece (red). This alternative is simpler (subset sum is directly reduced), more visual and without the issue that pieces of 2x1 can go both vertical and horizontal and mess things up. All polynominos can be placed in the rectangle (subset-sum = k placed at top row, total set-sum = n placed on bottom row) only if there is a solution to the subset problem.

Ben Wex
  • 51
  • 4