Skip to content
Advertisement

Using Knapsack approach without value?

Regarding to question, I am wondering that according to the following approach:

Assume that there is no value and

I am wondering that which approach or algorithm should be used for a Knapsack problem when the values are equal and there is a parameter (called n) that describes times for carrying items in a time?

For example, the bag has 3kg capacity and there are some blocks with the weight of 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2,75. Then we want to carry all the blocks with the minimum number of times (n). In this scenario, should I use Knapsack approach by giving value as 1. Or should I use completely another approach? Any idea?

Advertisement

Answer

Knapsack problem calculates maximum profit,So you obtain maximum number of times(n) if you assume all value as 1. But if you set all values as -1 and find max profit, you can achieve your goal.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement