Re: Problem with Maximize and conditions.
- To: mathgroup at smc.vnet.net
- Subject: [mg51091] Re: Problem with Maximize and conditions.
- From: "Janos D. Pinter" <jdpinter at hfx.eastlink.ca>
- Date: Mon, 4 Oct 2004 06:18:05 -0400 (EDT)
- References: <cjlna7$q7f$1@smc.vnet.net> <200410030947.FAA10680@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Colleagues, may I add a few general points to the discussion: - NMinimize (and the other similar fcts) is (are) not set up directly to solve models that include integer variables. However, it can be used to produce valid (lower) bounds, by omitting integrality restrictions and then solving the model. If then one can find a feasible solution, then the upper/lower bounds can be compared and used e.g. in branch-and-bound solution strategies. - Integer variable restrictions can be easily added to the model formulation as non-convex constraints, but that makes the numerical solution difficult. - Except in small models, simple enumeration will not work (e.g., 100 binary vars have 2^100 possible settings). - Continuous global optimization (GO) - or even integer linear programming - is already pretty hard; adding integer restrictions to GO models may increase the difficulty substantially. There is no 'universal' solver to tackle such models in full generality, for large model-instances (in spite of some grand claims by 'optimists'). Regards, Janos Pinter PS In the MathOptimizer Pro manual, we solve small instances of mixed integer models by using the continuous GO solver LGO, but the comments above still apply. >"Nacho" <ncc1701zzz at hotmail.com> wrote in message >news:cjlna7$q7f$1 at smc.vnet.net... > > 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! > >
- References:
- Re: Problem with Maximize and conditions.
- From: "Steve Luttrell" <steve_usenet@_removemefirst_luttrell.org.uk>
- Re: Problem with Maximize and conditions.