Question

127 views
Skip to first unread message

Tamara Alz

unread,
Jan 18, 2024, 12:15:51 PMJan 18
to am...@googlegroups.com

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;



Tamara Alz

unread,
Jan 18, 2024, 4:19:19 PMJan 18
to am...@googlegroups.com
I have an exam tomorrow, and I urgently need your answer.

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

Tamara Alz

unread,
Jan 19, 2024, 5:14:11 AMJan 19
to am...@googlegroups.com
Please can anyone explain it to me?

AMPL Google Group

unread,
Jan 19, 2024, 11:03:41 AMJan 19
to AMPL Modeling Language
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.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2484269648-121856#}
On Thu, Jan 18, 2024 at 9:19 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
I have an exam tomorrow, and I urgently need your answer.

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

On Thu, Jan 18, 2024 at 5:15 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:

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;



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/CALyZqOKisk-W0CceM1jYPg9ZvMHw1OmxsLsDGmbxO__H0qtPjw%40mail.gmail.com.

Tamara Alz

unread,
Feb 23, 2024, 8:31:31 PMFeb 23
to am...@googlegroups.com
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 <am...@googlegroups.com>:
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/reply-77152-2484269648-7452480550-1705634956-816274994%40helpscout.net.

Tamara Alz

unread,
Feb 24, 2024, 5:38:11 AMFeb 24
to am...@googlegroups.com
Hi again,

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

Thank you,

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

Tamara Alz

unread,
Feb 24, 2024, 8:43:46 AMFeb 24
to am...@googlegroups.com
Dear Robert,


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

AMPL Google Group

unread,
Feb 24, 2024, 3:44:16 PMFeb 24
to AMPL Modeling Language
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.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2484269648-121856#}
On Sat, Feb 24, 2024 at 1:43 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Dear Robert,

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

Thank you,

On Sat, Feb 24, 2024 at 10:38 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Hi again,

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

Thank you,

On Sat, Feb 24, 2024 at 1:31 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
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};

On Fri, Jan 19, 2024 at 10:14 AM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Please can anyone explain it to me?

بتاريخ الخميس، 18 يناير 2024، جاء من Tamara Alz <tamara...@gmail.com>:
On Fri, Jan 19, 2024 at 3:28 AM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
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.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
Reply all
Reply to author
Forward
0 new messages