[Top][All Lists]

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

Re: GMPL do not detect invalid subscript

From: Andrew Makhorin
Subject: Re: GMPL do not detect invalid subscript
Date: Wed, 12 Aug 2020 19:44:02 +0300

On Wed, 2020-08-12 at 17:33 +0200, Domingo Alvarez Duarte wrote:
> Hello Andrew !
> Thank you for reply !
> That's the problem It should not work, the constraint "zumVariance: 
> sum{z in Sample} E[z+10] = 0;" should give an error because when "z = 
> last_valid_subscript - 9" the resulting expression will be 
> "last_valid_subscript+1" and so on.

You declare E as

        var E{z in Sample};

so evaluating

        sum{z in Sample} E[z+10]

causes a domain (indexing) error as expected.

If, for example, Sample = {1..100}, the error will be detected on z = 91,
since z + 10 = 101 is not in Sample.

reply via email to

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