help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] fraction with vars


From: Andrew Makhorin
Subject: Re: [Help-glpk] fraction with vars
Date: Sat, 28 Apr 2012 06:29:22 +0400

> 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





reply via email to

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