Re: Linear Programming constraint
- To: mathgroup at smc.vnet.net
- Subject: [mg28552] Re: Linear Programming constraint
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 27 Apr 2001 03:56:06 -0400 (EDT)
- References: <9c7mcr$sbc@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Pramod,
ConstrainedMin[x + 3*y + 7*z,
{x - 3*y < 7 && 2*x + 3*z >= 5 || x + y + z >= 1},
{x, y, z}]
ConstrainedMin::cmeq:{} is not a valid equation or inequality.
So split into two probems:
cond = LogicalExpand[x - 3*y < 7 && 2*x + 3*z >= 5 ||
x + y + z >= 1]
2*x + 3*z >= 5 && x - 3*y < 7 || x + y + z >= 1
(ConstrainedMin[x + 3*y + 7*z, #1, {x, y, z}] & ) /@ cond
{5/2, {x -> 5/2, y -> 0, z -> 0}} ||
{1, {x -> 1, y -> 0, z -> 0}}
Take the solution giving the least minimum
Sort[%]
{1, {x -> 1, y -> 0, z -> 0}} ||
{5/2, {x -> 5/2, y -> 0, z -> 0}}
First[%]
{1, {x -> 1, y -> 0, z -> 0}}
You could refine the program to give which of the Or constraints are
satisfied.
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Pramod" <pramod at svw.com> wrote in message news:9c7mcr$sbc at smc.vnet.net...
>
> Hi,
>
> I have an LP problem with 6 constraints
>
> The problem is that last two constraints are OR constraints - not like
> other AND constraints
> ie., x1 < 40 OR x1 > 60
> Making it clear, the system should find optimal values for all
> variables, but the value of x1 should'nt be between 40 & 60
>
> How can i convert it to one or more AND constraints and add them to the
> rest of the constraints ?
>
> Please help me !!
>
> Thanks in Advance
>
> Pramod
>
>
>