MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: how to solve for all integer solutions, linear programming

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109851] Re: how to solve for all integer solutions, linear programming
  • From: Ladislav Lukas <lukaslad at gmail.com>
  • Date: Wed, 19 May 2010 20:15:24 -0400 (EDT)
  • References: <hrjh10$bgj$1@smc.vnet.net>

On 2 kv=C4=9B, 11:35, me13013 <me13... at 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



  • Prev by Date: Re: Equals, Less, Greater, etc; Confused by this simple output.
  • Next by Date: Re: Numerical solution of differential equation with boundary values
  • Previous by thread: Re: how to solve for all integer solutions, linear programming
  • Next by thread: Re: how uncouple dynamic objects?