I have a math problem that goes as follows:
I have a container which holds a total of 21000 kilos. I have 4 items A,B,C,D .
Item A weights 1 kilo. Item B weights 4 kilos. Item C weight 5 kilos. Item D weights 5 kilos also.
I am looking for an algorithm that will iterate through all possible combinations keeping the above equation. for example:
{20000 , 0, 0, 200} --> 20000*1 + 0*4 + 0*5 + 200*5 = 21000 kilos.
{19996, 1, 0, 200} --> 19996*1 + 1*4 + 0*5 + 200*5 = 21000 kilos.
Any points to the correct direction will be appreciated.