May 21, 2023
Hi,
Thanks!
The problem you are mentioning is called the subset sum problem. You can formulate it as optimization problem, e.g. by having binary decision variables x1, x2, x3, x4 and x5. The constraint would be 5*x1-3*x2-2*x3+15*x4-15*x5 = 0. So you can solve it with linear programming and store all the feasible solutions.
I think there are better algorithms available for this specific problem, that's worth a search :)
Hennie