[Top][All Lists]

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

Re: [Bug-glpk] 0-ary slice not allowed

From: Andrew Makhorin
Subject: Re: [Bug-glpk] 0-ary slice not allowed
Date: Wed, 26 Nov 2008 23:38:43 +0300

> 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;

reply via email to

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