Union of indexed sets

56 views
Skip to first unread message

Ana

unread,
Mar 27, 2020, 1:37:14 PM3/27/20
to AMPL Modeling Language
Hi AMPL Support Team,

I'm wirting to you to ask for support with writing set ot indexed sets as below:

set WARE ;
set WARE_CL {WARE};
set PLANT ;
set PLANT_CL{PLANT};
set CUSTO ;
set NODE = WARE union WARE_CL {WARE} union PLANT union PLANT_CL{PLANT} union CUSTO ;
set A1 within ((WARE cross PLANT) union (PLANT cross (PLANT union PLANT_CL{PLANT}))) ;
set A2 within ((PLANT cross CUSTO) union (CUSTO cross (CUSTO union PLANT_CL{PLANT}))) ;

I wrote as above and I got the following message:
WARE_CL {WARE} needs to be subscripted
PLANT_CL{PLANT} needs to be subscripted

Please can you help me with this. Thanks in adcance for your help.

Please receive my best regards.

AMPL Google Group

unread,
Mar 28, 2020, 3:36:43 PM3/28/20
to AMPL Modeling Language
When you specify "set WARE_CL {WARE};" you are defining a different set WARE_CL[w] for each w in WARE. I think you are trying to write the union of WARE and all the different sets WARE_CL; that would be written like this:

WARE union (union {w in WARE} WARE_CL[w])

The situation for PLANT and PLANT_CL is the same.


--
Robert Fourer
am...@googlegroups.com
{#HS:1121585771-71733#}
--
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/2c892084-5838-43f1-8e08-44a19f6dad56%40googlegroups.com.

Message has been deleted

Ana

unread,
Mar 28, 2020, 7:30:58 PM3/28/20
to AMPL Modeling Language
Good Afternoon Robert,

Many thanks for your reply and your useful help!
Reply all
Reply to author
Forward
0 new messages