help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Can I simulate step function in GLPK?


From: Michael Hennebry
Subject: Re: [Help-glpk] Can I simulate step function in GLPK?
Date: Wed, 1 Sep 2010 10:26:07 -0500 (CDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Wed, 1 Sep 2010, xiaomi wrote:

I am considering to use the property that the result of GLPK is
non-negative to simulate step function as follows:
for example: step function y=u(5);
minimize y
y<=M(x-5) , where M is a large number to simulate sharp slope.
y<=1;

It seems to imply that when y<=5, y>=M(x-5) && y>=0.
Does that work(fast?)? And is GLPK default to be non-negative result?

Not for x> 5.
In that case, y< 0.
Note that neither of you constraints is good for minimizing y.

I gather that you want to allow y to be 0 only in the range [0, 5]
and 1 only in the range [5, H], where H is an upper bound on x.
       ________
 _____|

The convex hull is a quadralateral.
Two of the sides are y>=0 and y<=1.
I'll leave the other two as an exercise for the reader.
Be sure to make y binary.
If you are minimizing y, you can omit two of the sides.

--
Michael   address@hidden
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



reply via email to

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