Prev: Series acting on a symbolic function
Next: Evaluating a sum from terms generated by the Array function
From: me13013 on 2 May 2010 05:35 Howdy, I have a small linear programming problem that I would like to solve for all integer solutions: 5a + 3b + 2c + 6d + 5e + f = 25 a + b + c <= 4 d + e + f <= 5 a,b,c,d,e,f >= 0 How can I pose this problem to Mathematica? I have looked at (and fiddled around with) the LinearProgramming function, but I don't see how to make ti give me the solution(s) I am looking for. Thanks for any help, Bob H
From: Murray Eisenberg on 3 May 2010 06:12 Reduce[{5 a + 3 b + 2 c + 6 d + 5 e + f == 25, a + b + c <= 4, d + e + f <= 5, a >= 0, b >= 0, c >= 0, d >= 0, e >= 0, f >= 0}, {a, b, c, d, e, f}, Integers] On 5/2/2010 5:35 AM, me13013 wrote: > Howdy, > > I have a small linear programming problem that I would like to solve > for all integer solutions: > > 5a + 3b + 2c + 6d + 5e + f = 25 > a + b + c<= 4 > d + e + f<= 5 > a,b,c,d,e,f>= 0 > > How can I pose this problem to Mathematica? > > I have looked at (and fiddled around with) the LinearProgramming > function, but I don't see how to make ti give me the solution(s) I am > looking for. > > Thanks for any help, > Bob H > -- Murray Eisenberg murray(a)math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
From: Harvey P. Dale on 3 May 2010 06:11 Bob: Reduce[{5 a + 3 b + 2 c + 6 d + 5 e + f ==== 25 && a + b + c <== 4 && d + e + f <== 5 && a >== 0 && b >== 0 && c >== 0 && d >== 0 && e >== 0 &= & f >== 0}, {a, b, c, d, e, f}, Integers] Best, Harvey -----Original Message----- From: me13013 [mailto:me13013(a)gmail.com] Sent: Sunday, May 02, 2010 5:36 AM Subject: how to solve for all integer solutions, linear programming Howdy, I have a small linear programming problem that I would like to solve for all integer solutions: 5a + 3b + 2c + 6d + 5e + f == 25 a + b + c <== 4 d + e + f <== 5 a,b,c,d,e,f >== 0 How can I pose this problem to Mathematica? I have looked at (and fiddled around with) the LinearProgramming function, but I don't see how to make ti give me the solution(s) I am looking for. Thanks for any help, Bob H
From: Ladislav Lukas on 19 May 2010 20:13
On 2 kv=C4=9B, 11:35, me13013 <me13...(a)gmail.com> wrote: > Howdy, > > I have a small linear programming problem that I would like to solve > for all integer solutions: > > =C2 5a + 3b + 2c + 6d + 5e + f = 25 > =C2 a + b + c <= 4 > =C2 d + e + f <= 5 > =C2 a,b,c,d,e,f >= 0 > > How can I pose this problem to Mathematica? > > I have looked at (and fiddled around with) the LinearProgramming > function, but I don't see how to make ti give me the solution(s) I am > looking for. > > Thanks for any help, > Bob H Hello Bob, Try the following: xLP = LinearProgramming[{-1, -1, -1, -1, -1, -1}, {{5, 3, 2, 6, 5, 1}, {1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1}}, {{25, 0}, {4, -1}, {5, -1}}] zvalLP = xLP.{-1, -1, -1, -1, -1, -1} and you should get the solution: {4, 0, 0, 0, 0, 5} -9 Ladislav |