[Top][All Lists]

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

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

From: Kasper Tordrup
Subject: Re: [Help-glpk] Fwd: fraction with vars
Date: Thu, 3 May 2012 11:42:03 +0200

thank you very much, this was a big help, exactly what I need

Best regards,

On Thu, May 3, 2012 at 2:40 AM, Michael Hennebry <address@hidden> wrote:
On Wed, 2 May 2012, Kasper Tordrup wrote:

So, as an example p=1000, y=1 and w=3 and so I want to find x=333.3333

Does this make it a bit more clear?


w and y are arrays of non-negative integer variables.
p is a vector of positive integers.
x is an array of continous variables.
If w_su is zero, then y_suj are zero and x_suj may be anything.

x_suj * w_su = p_s * y_suj

w_su = SUM k*q_suk

q_suk binary

SUM q_suk = 1

small-M method, M's are G's and L's.
q_suk = 1 -->
   x_suj * k >= p_s * y_suj
   x_suj * k <= p_s * y_suj

The constraints will be:
x_suj * k + G_sujk * (1-q_suk) >= p_s * y_suj
x_suj * k                      <= p_s * y_suj + L_sujk * (1-q_suk)
                                                          for all s, u, j, k

Regardless of the values of the G's and L's,
those constraints for which  q_suk=1 are valid.

The G's and L's need to be selected big enough to be valid if q_suk=0.

x_suj * k + G_sujk * (1-q_suk) >= p_s * y_suj
G_sujk * (1-q_suk) >= p_s * y_suj - x_suj * k     for all s, u, j, k
G_sujk * (1-q_suk) >= p_s * y_suj * (1-k/w_su)    for all s, u, j, k

It is sufficient that
G_sujk == p_s*max(y_suj)*(1-k/max(w_su)) == p_s*(max(w_su)-k),
assuming y_suj and w_su have the same range.

For k==max(w_su), w_su<=k-1 and it is sufficient that
G_sujk == -p_s

L_sujk * (1-q_suk) >= p_s * y_suj * (k/w_su-1)   for all s, u, j, k

It is sufficient that
L_sujk == p_s*max(y_suj*(k/w_su-1))
      == p_s*max(y_suj*(k/y_suj-1))   assuming a common range
      == p_s*max(k-y_suj)
      == p_s*k     assuming y_suj has lower bound of zero

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

Kasper Tordrup - Stud. M. Sc.
IMADA @ University of Southern Denmark
address@hidden - +45 27 44 58 49

reply via email to

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