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: xiaomi
Subject: Re: [Help-glpk] Can I simulate step function in GLPK?
Date: Wed, 01 Sep 2010 18:03:13 -0400
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

Thanks, Michael. I am sorry there are several typo in my original statement. Let me recify it as follows:
for example: step function y=u(5);
maxmize y
y<=M(x-5) , where M is a large number to simulate sharp slope.
y<=1;

The only wired thing is that when x<5, y will be y <= a number that is negative. However if y is nongative as default, can this property restrict y to be 0 when x<5? (without binary)





Michael Hennebry :
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.





reply via email to

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