Variable Returns Empty

32 views
Skip to first unread message

Akshay Kelkar

unread,
Sep 8, 2021, 11:36:31 AM9/8/21
to am...@googlegroups.com
Hi,  in the following code, the variable Cd returns empty. Could I be please assisted in identifying the error? 

I have attached the model and data file here. 

Thank you. 

Akshay Kelkar

TEST.mod
TEST.dat

Davi Doro

unread,
Sep 8, 2021, 1:33:28 PM9/8/21
to AMPL Modeling Language
Cd is empty because its indexing expression is such that there is no quintet (t, n, k, i, j) that satisfy the conditions you imposed.

If you take a look at the possible values for the quintet {t in tperiod, n in nDump, k in kDump[n], i in iDump[n], j in jDump[n]}, this is what you get:

1, W1, 3, 28, 17
1, W2, 3, 28, 18
1, W3, 3, 28, 19
1, W4, 3, 27, 17
1, W5, 3, 27, 18
1, W6, 3, 27, 19
1, W7, 3, 26, 17
1, W8, 3, 26, 18
1, W9, 3, 26, 19
1, W10, 4, 27, 18
1, W11, 3, 7, 11
2, W1, 3, 28, 17
2, W2, 3, 28, 18
2, W3, 3, 28, 19
2, W4, 3, 27, 17
2, W5, 3, 27, 18
2, W6, 3, 27, 19
2, W7, 3, 26, 17
2, W8, 3, 26, 18
2, W9, 3, 26, 19
2, W10, 4, 27, 18
2, W11, 3, 7, 11
3, W1, 3, 28, 17
3, W2, 3, 28, 18
3, W3, 3, 28, 19
3, W4, 3, 27, 17
3, W5, 3, 27, 18
3, W6, 3, 27, 19
3, W7, 3, 26, 17
3, W8, 3, 26, 18
3, W9, 3, 26, 19
3, W10, 4, 27, 18
3, W11, 3, 7, 11

But when you impose that (n,k,i,j) must be in mDump and (i-dl[n]) in iDump[n] and (i+dl[n]) in iDump[n] and (j-dl[n]) in jDump[n] and (j+dl[n]) in jDump[n] you won't get anything, because there is no quintet that satisfies that condition. In particular, you impose that i-1 and i+1 both need to be in iDump[n], when in fact iDump[n] only contains a single value for any n.

You can see my little test here:


Reply all
Reply to author
Forward
0 new messages