help-glpk
[Top][All Lists]

## Re: [Help-glpk] [Fwd: Re: fraction with vars]

 From: Michael Hennebry Subject: Re: [Help-glpk] [Fwd: Re: fraction with vars] Date: Wed, 7 Aug 2013 10:31:32 -0500 (CDT) User-agent: Alpine 1.00 (DEB 882 2007-12-20)

```On Wed, 7 Aug 2013, Andrew Makhorin wrote:

```
```-------- Forwarded Message --------
Subject: Re: [Help-glpk] fraction with vars
Date: Wed, 7 Aug 2013 00:22:06 -0300
```
```
```
```I'm trying to solve a similar problem: the division of the variable
'a' by the variable 'b'.

I couldnt figured out how GLPK's ln() (or log()) and exp() functions
work in these cases, which we are appliyng these functions on
variables. Is any linearization/transformation necessary?

And do the piecewise linear function using SOS2 constraints stand for
fractions? I tried to follow the example
```
```
I've never done it that way and never had the urge.

```
```x * y

so i did

a * (1 / b)

but then I dont know what to do with 1 / b.

Also, I cant see how the method appointed by Michael
(http://web.archiveorange.com/archive/v/5brOt80Ug9CHEU5WVM6q#6WwvpMWTxhPTY2D)
could be applied once we have something like

k / w_su - 1

and wouldnt be that a division of the variable 'a' by the variable 'b'?
```
```
Don't know exactly what you are trying to accomplish.
In general, to model w = x * y, where range(x) is finite and all are bounded:

x = SUM k*qx[k]
k in range(x)

1 = SUM qx[k]
k in range(x)

qk[range(x)] binary

if qx[k]==1, w=k*y    for k in range(x)
use the small-M method.

The size of the representation will be proportional to the size of range(x).

If x is continuous one could select a finite subset
of range(x) and subject qx to an SOS2 constraint instead of binary.
If the resulting approximation is not good enough,
one could change the subset and try again,
perhaps decreasing resolution at the ends
and increasing it near the previous solution.

--