Multi dimensional sets

Top  Previous  Next

Sets do not need to be one dimensional and rather can be composed as sets of other sets where the basic notation to identify the presence of an element is

 

set        multidimset(set1name,set2name)

 /set1elementname.set2elementname /

 

with the period separating the two set elements.

Examples:

(sets.gms)

 Sets         Origins                    Originating Places        /"New York", Boston/

         Destinations                Demand points        /"Portland",London, Houston/

         Linkedbyroad(origins,destinations)  Places linked by  roadways

                                 /"NEW York" .Portland, "New York" .Houston,

                                             boston.Portland, boston.Houston/;

Notes:

Up to 20 sets may be used to define a multidimensional set.
These sets are useful in speeding up GAMS and making sure that unneeded cases like sending goods by truck across the ocean are not considered in the context of conditionals.
A major use of multi dimensional sets is as a tuple in sums or conditions.
Shorthand notation may be used to specify elements in multidimensional sets using parentheses.  For example, the statement

Set xx(origins,destinations) /boston.(houston,london)/;

 is the same as the statement

Set xx(origins,destinations) /boston.houston,boston.london/;