       Re: Optimization with conditional restrictions

• To: mathgroup at smc.vnet.net
• Subject: [mg44545] Re: [mg44534] Optimization with conditional restrictions
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Fri, 14 Nov 2003 01:58:37 -0500 (EST)
• References: <200311131057.FAA23059@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```guillerm at usal.es wrote:
>
> Dear group,
> I wish minimize a function, ej:
> 55*x12 + 53*x22 + 53*x32 + 3000*x11 + 3000*x21 + 3000*x31
> including conditional restrictions, ej:
> x11 == If[x12 > 0, 1, 0] && x21 == If[x22 > 0, 1, 0] &&
> x31 == If[x32 > 0, 1, 0]},
> And other standars restrictions
>
> Here is an example:
>
> NMinimize[{55*x12 + 53*x22 + 53*x32 + 3000*x11 + 3000*x21 + 3000*x31,
> 25*x12 + 25*x22 + 25*x32 == 16000 && 0 <= x12 <= 336 &&
> 0 <= x22 <= 336 && 0 <= x32 <= 336 &&
> x11 ?¸ Integers && x21 ?¸ Integers && x31 ?¸ Integers &&
> x11 == If[x12 > 0, 1, 0] && x21 == If[x22 > 0, 1, 0] &&
> x31 == If[x32 > 0, 1, 0]}, {x11, x12, x21, x22, x31, x32}]
>
> Out[]:= {42920.000, {x11 -> 1, x12 -> 2.078*^-7, x21 -> 1, x22 -> 323.29, x31 -
> > 1, x32 -> 316.7}}
>
> The out is wrong, if x12-> 0, should be x11-> 0. I have tested changing the
> restricions, writting: x11 == If[x12 > 0.01, 1, 0] && x21 == If[x22 > 0.01, 1,
> 0] && x31 == If[x32 > 0.01, 1, 0]
>
> Any help
>
> Guillermo Sanchez
>
> ---------------------------------------------
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/

One thing that makes this work better is to assist NMinimize by making
explicit the allowable range (between 0 and 1 inclusive) for x11, x21,
and x31. Another thing that sometimes helps is to avoid "procedural"
programming description of function values in cases where a math
function will suffice (I do not know if it makes a difference in this
case).

In:= NMinimize[{55*x12 + 53*x22 + 53*x32 + 3000*x11 + 3000*x21 +
3000*x31,
{25*x12+25*x22+25*x32 == 16000,
0<=x12<=336, 0<=x22<=336, 0<=x32<=336,
Element[{x11,x21,x31},Integers], 0<=x11<=1, 0<=x21<=1, 0<=x31<=1,
x11==1-UnitStep[-x12], x21==1-UnitStep[-x22],
x31==1-UnitStep[-x32]}},
{x11, x12, x21, x22, x31,
x32}                                             ]

Out= {40528., {x11 -> 1, x12 -> 304., x21 -> 0, x22 -> 0., x31 -> 1,
x32 -> 336.}}

I do not know if this is optimal but it seems to be at least in the
ballpark I would expect. Morevoer, giving different parameter options
does not seem to improve it (at least not for the values I chose).

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Cartesian[(x, y, z)] is not a valid coordinate system specification
• Next by Date: Re: Re: Fluid dynamics
• Previous by thread: Optimization with conditional restrictions
• Next by thread: Re: Optimization with conditional restrictions