6.4 Circular Indexes

When working with indexes that represent time periods you sometimes encounter situations where you need to offset the index subscript value. For example, when you want to use a data entry from the previous month, MPL allows you to do this by using a offset value with the subscript such as in Inventory[month-1].

When the offset value goes outside the defined range for the index, MPL by default omits that vector entry. By defining an index as circular, you specify that when the offset value goes out of range, it takes values instead from the opposite end.

Index are defined as circular by entering the keyword CIRCULAR after the index definition. For example:
    INDEX
        day    := (mon, tue, wed, thu, fri, sat, sun) CIRCULAR;
        month  := 1..12 CIRCULAR;


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