I have tried researching how I can handle multiple optimal solutions based using dynamic programming. The answer is found from this question is simply that you have to backtrack. What if this is not possible and one of my solutions can't be found this way?
From this YouTube video we are given the problem of finding the optimal rod cuttings for maximizing profit.
The rod has a length of $n=5$, and the possible ways to cut with its respective values in parenthesis are $1(2)$, $2(5)$, $3(7)$ and $4(8)$. By setting up a matrix as in the video we end up finding that the optimal solution is $12$. By backtracking this we are only able to find one of the solutions $1,2,2$ and not the other solution consisting of $2,3$.
My question is, how can I combine dynamic programming with some sort of best sequence sum algorithm so that I am able to backtrack both solutions? The algorithm he proposes uses the max of the previous subproblem, however, that might not be the only solution as a combination of the current subproblem might also be feasible.
The matrix proposed in the video looks like this (rows are the possible cuts and columns are the rod length): $$ \begin{bmatrix} 0 & 2 & 4 & 6 & 8 & 10 \\ 0 & 2 & 5 & 7 & 10 & 12 \\ 0 & 2 & 5 & 7 & 10 & 12 \\ 0 & 2 & 5 & 7 & 10 & 12 \\ \end{bmatrix} $$