previous contents next
Previous: Expressions Next: The Network Plane

Element Selectors and Iterators

In EMME/2, sub-network selection is implemented by a simple mechanism, in which a set of selection clauses is specified by the user, each clause being composed of an attribute and a corresponding value range. Network elements are selected if they satisfy the combination of all selection clauses.

In Enif, all network element selections are based on expressions. A selector is an expression which is used to determine which elements of a given type are used in a certain functionality. The expression is evaluated for each element of the given type and if the expression result is non-zero (or a non-empty string in the case of a string valued expression) the element is selected, whereas elements yielding a zero numeric value (or an empty string) are not selected. An exception to this rule is if the selection expression is empty, in which case all elements will be selected (this is different from EMME/2 where a selection without any clauses implied an empty set of network elements). In order to set a selector to select no elements, it suffices to set the selector expression explicitly to 0.

In order to allow an efficient handling of subsets, the selector expression is only evaluated once for each network element and the results are used to build a list of pointers to the selected elements which can then be traversed very efficiently for as many times as needed without any additional computational overhead.

Figure 3: Same node value plot using four different iterator expressions
\includegraphics[width=.5\textwidth, keepaspectratio]{}\includegraphics[width=.5\textwidth, keepaspectratio]{} \includegraphics[width=.5\textwidth, keepaspectratio]{}\includegraphics[width=.5\textwidth, keepaspectratio]{}

While the element selection is used to decide which elements to use or not use in a certain functionality, it does not imply any particular order in which the elements are processed. In EMME/2, network elements are always processed in the sequence of ascending identifiers, i.e. in the same order they are stored in the data bank. In Enif, it is possible to define the order in which the selected elements of a given type are processed by means of a so called iterator expression. If an iterator expression is specified, the selected elements are processed in the order of increasing values of the iterator expression (or ascending collating sequence for string valued expressions). If no iterator expression is specified, the standard sequence following increasing element identifiers is used by default.

Thus, in Enif the concept of element selection always includes the option of also specifying the processing order of the selected elements. This is done by allowing the selector expression to provide the iterator value as an optional second subexpression. E.g. using the link selector ``volau>1000, -volau'' in a link list will select all links having an auto volume larger than 1000 and will sort the list to have the largest volumes first.

While the use of iterator expressions is evident for lists, it has also important implications when displaying overlapping graphic elements: elements drawn later will hide those elements drawn earlier at the same position. This is illustrated in Figure 3. It contains four times the same node value plot showing the attractions (stored in destination matrix md9) as proportional circles for the subset of nodes which correspond to zones (element selection: isZone). The only difference between the plots is the iterator expression. The following processing orders are shown: a) according to increasing attractions (md9), b) decreasing attractions (-md9), c) from left to right (xi) and d) from outside toward the network center (-sqrt(xi^2+yi^2), the origin of the coordinate system happens to be in the city center).

previous contents next
Previous: Expressions Next: The Network Plane

Enif - Toward a New Interface for EMME/2, Heinz Spiess, October 2000