[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Linear program - Difficulty expressing a constraint

From: gaurav khanna
Subject: Re: [Help-glpk] Linear program - Difficulty expressing a constraint
Date: Sun, 30 Sep 2007 12:35:10 +0400

Hi Andrew,

This is a nice way of doing it and works with two variables x1 and x2. But
can such a method be generalized to more than two variables? Say, for
example, I have three non-negative variables x1, x2 and x3 and I want to
enforce that only one of them will be non-zero. Can this also be expressed
with linear constraints?


Gaurav Khanna
Phd Student
CSE Department,OSU

Phone (office):614-292-7036

On Fri, 21 Sep 2007, Andrew Makhorin wrote:

> > I have a linear program in which all the variables are continuous
> > variables which are free to have values from 0 to infinity. Among those
> > there are two variables, only one of which can be non-zero. I am not sure
> > how to express this as a linear constraint. Could you help me with this?
> Let x1 and x2 be non-negative variables, and z is a binary variable,
> where z = 0 means that x1 = 0 while z = 1 means that x2 = 0. Then:
> 0 <= x1 <= M1 * z
> 0 <= x2 <= M2 * (1 - z)
> where M1 and M2 are some upper bounds of x1 and x2, resp.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]