[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: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Linear program - Difficulty expressing a constraint |
Date: |
Fri, 21 Sep 2007 16:09:43 +0400 |
> 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.