       Problem with Maximize and conditions.

• To: mathgroup at smc.vnet.net
• Subject: [mg51046] Problem with Maximize and conditions.
• From: ncc1701zzz at hotmail.com (Nacho)
• Date: Sat, 2 Oct 2004 03:19:05 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello.

I was trying to solve a problem with Mathematica 5 and I am getting
strange results.

The problem is:

Minimize x+y+z, with the condition that 1/20x+y+5z==100 and x,y,z are
Integers between 1 and 98 (inclusive).

So I use:

Minimize[{x+y+z, 1/20 x+y+5z\[Equal]100,  x \[Element] Integers,
y \[Element] Integers, z\[Element]Integers, 0<x<99,0<y<99,0<z<99},
{x,y,
z}]

I have copied the text using "Plain text" option, I hope it's fine.

This returns the same expression, I suppose that Mathematica cannot
resolve it. So I use NMinimize:

NMinimize[{x+y+z, 1/20 x+y+5z\[Equal]100,  x \[Element] Integers,
y \[Element] Integers, z\[Element]Integers, 0<x<99,0<y<99,0<z<99},
{x,y,
z}]

Now I get a result, but rather weird...

\!\({25.`, {x -> 1, y -> 5, z -> 1899\/100}}\)

The minimum of x+y+z is 25 but z is 1899/100
1899/100 is not a Integers, and the nearest Integer, 19, doesn't
satisfy 1/20x+y+5z==100, and also x+y+z is not 25 but 24.99

I don't know why Mathematica has returned a Real when I specified an
Integers. I suppose that it is related to the use of NMinimize. I
suppose that it considers that 18.99 is so near of 19 that it can be
considered an Integer.

If you remove the condition of z being an Integer, the result changes,
so it is affecting. Also, if you ask for "1899/100 e Integers" it
returns False.

So, does anybody know how to solve this? Ideally, I would like to know
why Minimize doesn't work (so I have to use NMinimize), but in any
case, how to solve the problem.

Thanks!

```

• Prev by Date: Re: Re: Linear Programming
• Next by Date: Re: Fast multiplication of polynomials mod p
• Previous by thread: Re: Re: Problem with Maximize and conditions.
• Next by thread: Re: Problem with Maximize and conditions.