[AMPL 24951] Question

Hi Robert Fourer,

I need your help please.

I found these “set,” “parameters,” and “variables,” and there is this constraint:

Why did this person impose the constraint on “j” and “i” and didn’t remove them from “Power1” or from the variable “Q” in the constraint? When I tried to remove them using AMPL, it gave me an error. Can you please explain what’s happening here and what is this situation called in AMPL?

I have an exam tomorrow and I need to explain why he still keeps i and j

………

set Power1 within {J,M,I,F,W};

param Power_Level1{Power1};

set Power2 within {I, H,K,P,W};

param Power_Level2{Power2};

var Q{(j,m,i,f,wu) in Power1 , (n,h,k,p,wd) in Power2}binary;

#Constrant

s.t. Power_level_node {j in J ,i in I} : sum {(j,m,i,f,wu) in Power1 ,(n,h,k,p,wd) in Power2} Q [j,m,i,f,wu,n,h,k,p,wd]<=1;

I have an exam tomorrow, and I urgently need your answer.

بتاريخ الخميس، 18 يناير 2024، جاء من Tamara Alz <tamara.73zhro@gmail.com>:

Please can anyone explain it to me?

بتاريخ الخميس، 18 يناير 2024، جاء من Tamara Alz <tamara.73zhro@gmail.com>:

When the s.t. statement defines indexes i and j,

s.t. Power_level_node {j in J, i in I} ...

and then i and j are used for indexing in the constraint expression,

sum {(j,m,i,f,wu) in Power1, ...

then the indexing is over a “slice” through set Power1. For each combination of i and j, AMPL interprets “(j,m,i,f,wu) in Power1” to mean the set of all m, f, and wu such that (j,m,i,f,wu) is a member of Power1. Slices are discussed in Chapter 6 of the AMPL book, in Section 6.2 Subsets and slices of ordered pairs and in Section 6.3 Sets of longer tuples.

Thank you for answer.

I have one question I hope you can help me.

If I want give description Power 1, can I say that it is a set that contains the following set.

I understand the mathematical workings of Power 1, but I would like a description of it.

Should I write Power 1 as a set that includes all these sets , knowing that each element within it is a set?

Set Power1 contains {J, M, I, F, W};

Parameter Power_Level1 {Power1};

بتاريخ الجمعة، 19 يناير 2024، جاء من AMPL Google Group <ampl@googlegroups.com>:

Hi again,

Do we consider Power 1 a set or a subset?"

Thank you,

بتاريخ السبت، 24 فبراير 2024، جاء من Tamara Alz <tamara.73zhro@gmail.com>:

Dear Robert,

I am very confused as to whether it is a set or subset.

Thank you,

بتاريخ السبت، 24 فبراير 2024، جاء من Tamara Alz <tamara.73zhro@gmail.com>:

Each member of set Power1 is a list of 5 elements – called a “5-tuple” – where the first element is from set J, the second is from set M, the third is from set I, the fourth is from set F, and the fifth is from set W. You can define Power1 like this:

set J;
set M;
set I;
set F;
set W;
set Power1 within {J,M,I,F,W};

The parameter Power_Level1 has a value corresponding to each member of set Power1, so Power_Level1 is defined like this:

param Power_Level1 {Power1};

If j is a member of J, m is a member of M, i is a member of I, f is a member of F, and w is a member of W, then (j,m,i,f,w) is a 5-tuple that is a member of Power1, and Power_level1[j,m,i,f,w] is the corresponding value of parameter Power_Level1.

In the AMPL book, Section 6.3 Sets of longer tuples explains tuples. Also, data for parameters indexed over tuples is discussed in Section 9.2 Data in lists and in Section 9.3 Data in tables.