> constraint

> s.t. cost {i in N, j in N} :
>   t[i] - t[j] - sum{(i,j) in E} c[i,j] * x[i,j] >= 0;

> leads to error

> 0-ary slice not allowed

> in glpmpl01.c, function expression_list.

> My expectation was that the sum is 0 if (i,j) is not an element of E and
> c[i,j] x[i,j] otherwise. This would be in conformance with the usual use
> of domain parameters.

No, I do not think so. In the strong mathematical sense a composite
index must have at least one free dummy variable; otherwise corresponding
aggregate operator like sum has no meaning. Besides, AMPL also does not
allow that.

> I must admit that the following is an alternative notation but less
> elegant:

> s.t. cost {i in N, j in N } :
>   t[i] - t[j] -  ( if ((i,j) in E) then c[i,j] * x[i,j] else 0 ) >= 0;

Well, the following is more elegant, or at least more readable than
using the sum operator :)

s.t. cost {i in N, j in N } :
  t[i] - t[j] -  (if (i,j) in E then c[i,j] * x[i,j]) >= 0;





_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to