Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: About linear programming

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126222] Re: About linear programming
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 26 Apr 2012 05:25:27 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201204250433.AAA06504@smc.vnet.net>

In both cases, a lower bound must be placed on Subscript[x, 3]

eqns1 = {5 Subscript[x, 1] + 4 Subscript[x, 2] + 3 Subscript[x, 3],
   Subscript[x, 1] + Subscript[x, 3] <= 15,
   Subscript[x, 2] + 2 Subscript[x, 3] <= 25,
   Subscript[x, 3] >= x3min};

sol1 = Maximize[eqns1,
   {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]}];

sol1 /. x3min -> 0

{175, {Subscript[x, 1] -> 15, Subscript[x, 2] -> 25, Subscript[x, 3] -> 0}}

eqns2 = Rationalize[{
    30 Subscript[x, 1] + 40 Subscript[x, 2] + 20 Subscript[x, 3] +
     10 Subscript[x, 4] - 15 Subscript[x, 5] - 20 Subscript[x, 6] -
     10 Subscript[x, 7] - 8 Subscript[x, 8],
    0.3 Subscript[x, 1] + 0.3 Subscript[x, 2] +
      0.25 Subscript[x, 3] + 0.15 Subscript[x, 4] <= 1000,
    0.25 Subscript[x, 1] + 0.35 Subscript[x, 2] +
      0.3 Subscript[x, 3] + 0.1 Subscript[x, 4] <= 1000,
    0.45 Subscript[x, 1] + 0.5 Subscript[x, 2] +
      0.4 Subscript[x, 3] + 0.22 Subscript[x, 4] <= 1000,
    0.15 Subscript[x, 1] + 0.15 Subscript[x, 2] +
      0.1 Subscript[x, 3] + 0.05 Subscript[x, 4] <= 1000,
    Subscript[x, 1] + Subscript[x, 5] == 800,
    Subscript[x, 2] + Subscript[x, 6] == 750,
    Subscript[x, 3] + Subscript[x, 7] == 600,
    Subscript[x, 4] + Subscript[x, 8] == 500,
    Subscript[x, 3] >= x3min}, 0];

sol2 = Maximize[eqns2,
   {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3],
    Subscript[x, 4], Subscript[x, 5], Subscript[x, 6],
    Subscript[x, 7], Subscript[x, 8]}];

sol2 /. x3min -> 0

{5531000/37, {Subscript[x, 1] -> 660000/37,
     Subscript[x, 2] -> -(80000/37), Subscript[x, 3] -> 0,
     Subscript[x, 4] -> -(1000000/37), Subscript[x, 5] ->
       -(630400/37), Subscript[x, 6] -> 107750/37,
     Subscript[x, 7] -> 600, Subscript[x, 8] -> 1018500/37}}


Bob Hanlon


2012/4/25 Marcela Villa Marulanda <mavima10 at gmail.com>:
> Hi,
>
> I attempt to solve these linear programming problems in Mathematica,
> but its result is "Maximize::natt: The maximum is not attained at any
> point satisfying the given constraints", why? I've solved this problem
> in other applications and the solution is achieved.
>
> I don't know the reasons about it. I'll thank to whom give me some
> clues!
>
> Problem 1
>
> Maximize[{5 Subscript[x, 1] + 4 Subscript[x, 2] + 3 Subscript[x, 3],
>   Subscript[x, 1] + Subscript[x, 3] <= 15 &&
>    Subscript[x, 2] + 2 Subscript[x, 3] <= 25}, {Subscript[x, 1],
>   Subscript[x, 2], Subscript[x, 3]}];
>
> Problem 2
>
> Maximize[{30 Subscript[x, 1] + 40 Subscript[x, 2] +
>   20 Subscript[x, 3] + 10 Subscript[x, 4] - 15 Subscript[x, 5] -
>   20 Subscript[x, 6] - 10 Subscript[x, 7] - 8 Subscript[x, 8],
>  0.3 Subscript[x, 1] + 0.3 Subscript[x, 2] + 0.25 Subscript[x, 3] +
>     0.15 Subscript[x, 4] <= 1000 &&
>   0.25 Subscript[x, 1] + 0.35 Subscript[x, 2] +
>     0.3 Subscript[x, 3] + 0.1 Subscript[x, 4] <= 1000 &&
>   0.45 Subscript[x, 1] + 0.5 Subscript[x, 2] + 0.4 Subscript[x, 3] +
>     0.22 Subscript[x, 4] <= 1000 &&
>   0.15 Subscript[x, 1] + 0.15 Subscript[x, 2] +
>     0.1 Subscript[x, 3] + 0.05 Subscript[x, 4] <= 1000 &&
>   Subscript[x, 1] + Subscript[x, 5] == 800 &&
>   Subscript[x, 2] + Subscript[x, 6] == 750 &&
>   Subscript[x, 3] + Subscript[x, 7] == 600 &&
>   Subscript[x, 4] + Subscript[x, 8] == 500}, {Subscript[x, 1],
>  Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], Subscript[x, 5],
>  Subscript[x, 6], Subscript[x, 7], Subscript[x, 8]}]
>



  • Prev by Date: Re: Controlling scale of Graphics on paper
  • Next by Date: Re: how to check for NumericQ arbitrary data structure
  • Previous by thread: About linear programming
  • Next by thread: Re: About linear programming