I have very little experience in dynamic programming. I used it to solve the DNA alignment problem, the problem with the main backpack and the simple problem of finding paths. I understood how they work, but I donβt feel absolutely comfortable.
I have a problem that reminds me of dynamic programming 0-1, but the differences have thrown me away and I'm not sure if I can use this technique or if I have to agree to a recursive approach.
Let's say I have a list of items, each of which has different meanings, weight and costs. There may be more than one item.
Let's say I need to choose combos from those items that are the most valuable, but remain within the range of weight and cost. So far, I have described a backpack problem, to a large extent, with two limitations. But here is the difference:
The value of the selected item changes depending on how many of them I have in the combo.
Let's say that each element has a function associated with it, which tells me which group of these items is worth me. This is a basic linear function such as value_of_item = -3 (the amount of this element) + 50
So, if I have one element in a combo, then for me this value is 47. If I had 2 of them, then they are only 44 for me.
If for this I use a dynamic programming table, then for each cell I will need to step back to see if this element is in the current combo, which makes DP pointless. But maybe there is a way to redo the problem so that I can use DP.
Hope that made sense.
An alternative is to create each combination of elements, within cost and weight, to determine the value of each combo, select the most valuable combo. For a list of 1000 items, even this will be an expensive search, and this is what I will count many times. I would like to find a way to take advantage of DP.