[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-glpk] 0-ary slice not allowed
From: |
glpk xypron |
Subject: |
Re: [Bug-glpk] 0-ary slice not allowed |
Date: |
Wed, 26 Nov 2008 23:03:24 +0100 |
> Do you agree that the following notation is meaningless?
>
> sum{(2,3) in E} c[i,j] * x[i,j]
>
> This is exactly the same as your example: the composite index has no free
> dummy variables.
Hello Andrew:
My understanding of common indices is that they are a shorthand for unnecessary
equality constraints in the domain:
s.t. con {i in N} :
sum{(i,j) in E} x[i] = 0;
is translated to:
s.t. con {i in N} :
sum{(k, j) in E : k == i} x[i] = 0;
Hence
s.t. con {(i,j) in {(2,3)} :
t[i] - t [j] + sum{(i,j) in E} c[i,j] * x[i,j] = 0;
translates to
s.t. con[2,3] :
t[2] - t [3] + sum{(k,l) in E : k == 2 && l == 3 } c[2,3] * x[2,3] = 0;
which has an obvious meaning:
{(k,l) in E : k == 2 && l == 3 } has 0 free dimensions (you call it 0-ary) and
can have 0 to 1 elements.
Besides
s.t. cost {i in N, j in N} :
t[i] - t[j] - sum{(k, l) in E : k == i && l == j} c[i,j] * x[i,j] >= 0;
is allowed by GLPK though the domain of the sum has no free dimension.
To answer your question:
sum{(2,3) in E} 1
should be 1 if (2,3) is an element of E and 0 if it is not, because it is a
short hand for
"the sum of 1 over all elements in E which are (2,3)" :
sum{(i,j) in E : i==2 && j ==3} 1
Best regards
Xypron
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
http://www.gmx.net/de/go/multimessenger