3

How can I find all feasible solutions to a 0-1 integer program that I have based on a knapsack-style problem?

I have $n$ items and $m$ knapsacks. Each knapsack has a space limitation and each item occupies some space. I need to find all feasible combinations of items which can fit in the knapsacks.

The brute force approach is to find all possible combinations of items up to length $n$ and then evaluate each combination for feasibility.

My current approach is to formulate the problem as an IP where each item is a binary decision variable. I maximize the sum of decision variables provided the $m$ space constraints for each knapsack. This gives me the maximum number of items $r$ which can fit in the knapsacks. Then I use the following algorithm to find the set of feasible solutions:

  1. Initialize two sets ---feasible and infeasible as empty.
  2. Add all combinations of items with length $> r$ to infeasible set.
  3. Formulate all combinations of length $r$. For each of these combinations which are not present in the feasible set, check feasibility. If feasible add this combination and all sub combinations of length $< r$ to the feasible set. If infeasible, add this combination to the infeasible set.
  4. Set $r := r-1$.
  5. Repeat step 2 until $r = 1$.

Is there any other method which is more efficient than this approach?

D.W.
  • 159,275
  • 20
  • 227
  • 470
deep
  • 31
  • 1
  • Write your IP, please. – Rodrigo de Azevedo Dec 21 '19 at 13:31
  • It sounded like you might have been asking one of two questions: How do I enumerate all solutions to an IP problem in general? How do I enumerate all solutions to my specific IP problem? I edited the question to focus on the latter. For the former, see https://cs.stackexchange.com/q/118849/755. – D.W. Dec 24 '19 at 19:15
  • If IP=PSPACE (and it does), I don't believe this problem is in either, because the solution alone may not be polynomialy bound in size. If you have n items, that gives you 2^n possible item sets and in the worst case you'd have to return all of them. There may however be some really strong compression I'm missing (if a superset is in the solution, don't enumerate the smaller sets). If you rephrased it as a decision problem (e.g. there are more than k valid sets), then we'd be talking. Then I'd guess it would have been in delta_2, so not a really easy thing to solve either – Ordoshsen Dec 24 '19 at 23:47

0 Answers0