I am looking for a way to find all possible solutions given a certain set of constraints. I had prolog in school but it has been a while so consider me fairly new. What I want to achieve is something like this:
fC(U,V,X,Y,Z):-
(U*2 + V - Y -(2*Z)) =< -5,
(U*2 + V - Y -(2*Z)) >= -108,
(U+V+X+Y+Z) =:= 54.
U, V, X, Y, and Z are non negative numbers. They only have 2 rules to compute them: be between -5 and -108 (when multiplied with certain weight which I tried to formulate in the code above) and added together be exactly 54.
I tried generating 5 lists of 0 to 54, find all combinations and then go over them to check my 'constraints', I quickly ran out of memory so I must be doing something wrong.
Kind regards,
Jelle