6.5 Subsets of Indexes

Sometimes, you want to use only a few elements or subset of an index. MPL allows you to declare a new index that selects out certain elements of another underlying index. For example, assume you have defined the following indexes:

    INDEX
        i := 1..10
        m := (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);

You can then use them to define these indexes as subsets of the original indexes:

        j[i] := (2,3,5);
        HolidayMonth[m] := (Apr,Jul,Aug);
    RepairMonth[m] WHERE (m >=Apr) AND (m <= Jun);

Here the underlying index for j is i and for HolidayMonth is m.

You can also define an index as a list of numbers, i.e. an enumeration of numbers instead of strings. MPL treats this kind of index as a subset index without an underlying index. For example:

        k := (0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75);

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page