Find all solutions (A,B,C,D) (where these variables are all natural numbers) that satisfy the constraints
3A+1B+2C+5D = x , 6<=x<=30
Give some ideas about how this might be solved in Excel
1 Answer | Add Yours
To satisfy the first constraint, namely
we need four natural numbers (0 and integers) that sum to 6. The possibilities are (where the string of four numbers is in no particular order):
0006, 0015, 0024, 0033, 0114, 0123, 1113, 1122
(I think you can work these strings out using the Simplex Algorithm. In Excel you could sum all possible combinations of each of A,B,C,D being from 0-6 and use an if statement to find which A+B+C+D cells satisfy the total of 6)
For the next constraint order the constraint equation in terms of the size of the coefficients. That is write,
For the possible string combinations above, test the minimal and maximal sets only. By which I mean, say for the combination 0006, check that
i) 6<=1B<=30 when B=6 (A,C,D all equal to 0) and ii) 6<=5D<=30 when D=6 (A,B,C all equal to 0).
For combination 0123 for example, check that
i) 6<=3A+2C+1B<=30 when B=3,C=2,A=1 (min) and when B=1,C=2,A=3 (max) (D=0), and
ii) 6<=5D+3A+2C<=30 when D=1,A=2,C=3 (min) and when D=3,A=2,C=1 (max) (B=0)
The combinations of A,B,C,D that satisfy the constraint k can again be done in Excel using if statements on the minimal and maximal sums.
If you work through all of this you should find that all combinations of letters satisfy the possible strings adding to 6 given above, so that there are
0006 (1 x 4), 0015 (2 x 6), 0024 (2 x 6), 0033 (6), 0114 (3 x 4), 0123 (3 x 4), 1113 (4 x 1), 1122 (6 x 1) = 4 + 12 + 12 + 6 + 12 + 12 + 4 + 6 = 68 solutions
Answer: there are 68 solutions that satisfy the combination of the two constraints, where each of A,B,C,D are in the range 0-6.
We’ve answered 319,627 questions. We can answer yours, too.Ask a question