3

Given an array x of length n, and a set of arrays S such that each array in S has length n, find a maximal size set of arrays G in S such that for all 1 <= i <= n, x[i] >= sum(g[i]) for all g in G.

e.x. if x = [3, 3] and S = {[3, 0], [1, 1], [2, 1]}, then the best set is {[1, 1], [2, 1]} because the sum is [3, 2] and the element at each index is less than the corresponding element in x. {[3, 0], [1, 1]} does not work because the sum is [4, 1], and 4 > x[0] = 3.

Is there an algorithm whose run time is polynomial in n and |S|?

Background/Context: This question arose from a question on scrabble. Given a list of tiles, and a word, can you form the word with the tiles? I extended it to given a list of tiles, and a list of words, what is the maximum number of words in the list that can be formed from the tiles?

3
  • 3
    This is multi-dimensional knapsack problem. It allows a pseudo-polynomial time algorithm only for fixed n. Commented Oct 17, 2012 at 19:41
  • The number of partitions of 9 (or whatever the number of owned tiles is) isn't that much. I'd go with brute-force. Commented Oct 17, 2012 at 19:59
  • Also see liv.ac.uk COMP202's NP-complete item 43 (Garey and Johnson's SP10) that may be equivalent Commented Oct 17, 2012 at 20:40

1 Answer 1

3

This is multi-dimensional knapsack problem.

To prove that there is no algorithm, polynomial-time in both n and |S| (or to prove that this is a Strongly NP-hard problem), simplify this problem, allowing only values 1 for array x and values 0 or 1 for arrays S. After this simplification we get exactly the optimization version of Set packing, which is a classical NP-complete problem.

Relation to set packing problem suggests that there is also no good approximation algorithm.

This leaves pretty limited choice of algorithms:

  1. Branch-and-bound.
  2. Integer linear programming.
  3. Metaheuristic algorithms like Simulated annealing or Tabu search.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.