I have a question based on the one posted here:
Combination problem with constraints
We have 4 containers and one pitcher of water that holds 100L. Each container has different capacities with maximums of, 70L, 45L, 33L and 11L levels respectively.
We can solve the number of all possible combinations that a total of 100L of water can be poured among a number of containers, using dynamic programming. In this case, it would be 14948.
As https://math.stackexchange.com/users/8508/robert-israel did it in the post above, we have:
F(100,4) = \sum_{x=0}^{11} F(100-x,3)
Now I'm trying to generate in a matrix the whole 14948 solutions, but how is it possible to generate only the combinations that match the constraint?
It seems like I can't use DP to create the solutions, because each state (y,j) depends on the previous state (y,j-1) and (y-1,j) (with (y,j) the number of solutions of x1+…+xj=y), which means that it doesn't seem feasible to construct the solutions of the new state (y,j) where the sum needs to be j upon a previous state where the sum needs to be j-1 .
Any suggestions?