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:
- Initialize two sets ---feasible and infeasible as empty.
- Add all combinations of items with length $> r$ to infeasible set.
- 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.
- Set $r := r-1$.
- Repeat step 2 until $r = 1$.
Is there any other method which is more efficient than this approach?