Re: Optimization with conditional restrictions
- To: mathgroup at smc.vnet.net
- Subject: [mg44593] Re: Optimization with conditional restrictions
- From: "Dana DeLouis" <delouis at bellsouth.net>
- Date: Mon, 17 Nov 2003 03:38:25 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
This is very similar to Danielâ?? solution. equ = 3000*x11 + 55*x12 + 3000*x21 + 53*x22 + 3000*x31 + 53*x32; var = Variables[equ] {x11, x12, x21, x22, x31, x32} We note the following constraint: FullSimplify[25*x12 + 25*x22 + 25*x32 == 16000] x12 + x22 + x32 == 640 const = {x12 + x22 + x32 == 640, 0 <= x12 <= 336, 0 <= x22 <= 336, 0 <= x32 <= 336, (x11 | x21 | x31) â?? Integers, x11 == -DiscreteDelta[x12] + 1, x21 == -DiscreteDelta[x22] + 1, x31 == -DiscreteDelta[x32] + 1}; solution = Rationalize[NMinimize[{equ, const}, var]] {40528, {x11 -> 1, x12 -> 304, x21 -> 1, x22 -> 336, x31 -> 0, x32 -> 0}} -- Dana DeLouis Windows XP Mathematica 5.0 for Windows delouis at bellsouth.net = = = = = = = = = = = = = = = = = <guillerm at usal.es> wrote in message news:bovoca$mj6$1 at smc.vnet.net... > > 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