[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] fraction with vars
From: |
Michael Hennebry |
Subject: |
Re: [Help-glpk] fraction with vars |
Date: |
Sat, 28 Apr 2012 15:58:47 -0500 (CDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Sat, 28 Apr 2012, Andrew Makhorin wrote:
I have a problem with calculating a fraction, the reason is that both
the nominator and denominator are variables.
So I am looking for some way to make this linear:
x_suj = p_s * (y_suj/w_su) or well just find what this fraction
is: y_suj/w_su
where p_s is a constant, x,y and w are integer variables. and I also
need to avoid the division with 0 problem.
Anyone know some tips/tricks for this?
Another way is to replace the variables by their logarithms:
ln x_suj = ln p_s + ln y_suj - ln w_su
and then, depending on the context, model the exponenta
z = exp(ln z)
by a piecewise linear function using SOS2 constraints; see
http://lists.gnu.org/archive/html/help-glpk/2007-06/msg00005.html
http://winglpk.sourceforge.net/media/glpk-sos2_02.pdf
To me, the other suggestions seem better.
They are a bit smaller and still all-integer.
I think that something similar with fewer variables could be done,
but more analysis would be needed.
--
Michael address@hidden
"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