On Fri, 24 Aug 2012, Mate Hegyhati wrote:

For the aforementioned case the simplest solution is probably this:

u = pos - neg;
pos <= M * x;
neg <= M * (1-x);

where M is bigger than the maximum of |u|

in this case, at most one of pos or neg is positive. If neg  (u<0), then
x must be 0, if it is the pos that is positive (u>0), then x must be 1.
If both of neg and pos are 0, x can be, however, either 0 or 1.

For a tighter constraint, the two M's should be different:
one should be the upper bound on u,
the other should be the absolute value of the lower bound.

That said, upper(|u|) is better than the old standby, pick something huge.

You can also do this thing without pos and neg as well, in a form like this:

u <= 0 + M * x;
u >= 0 - M * (1-x);

On 08/24/2012 04:47 AM, ajengdewi...@yahoo.com wrote:
I have a problem which has variable named 'u' and 'x'
Variabel x is binary variabel which will have value 0 if u<=0 and  1 if u>0

--
Michael   henne...@web.cs.ndsu.nodak.edu
"On Monday, I'm gonna have to tell my kindergarten class,
whom I teach not to run with scissors,
that my fiance ran me through with a broadsword."  --  Lily

_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to